complex SQL query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zonar00
    New Member
    • Oct 2007
    • 16

    complex SQL query

    http://img100.imagesha ck.us/my.php?image=sq loi8.png

    (please refer this first before proceeding)

    I want a SQL query that satisfies the following results:-

    Question# I want to count the rows where the client + server IP remain same over a particular # of entries like 10,20 and etc.
    E.g 1-4 is a pattern where both client and server ip have remain same. I want a count of that.

    Sub-Question# Secondly, i wanna retrieve only the most recent record .The pattern which was prevalent in the time b/w 12:22 to 1:00 is irrelevent i want the next query to execute with the current time.

    I used SQLdata reader but it is being unable to retrieve
    me the exact count i require due to inherent restriction that comes
    with the scope of this method. I cannot use it DataGrid because
    im using a command application(dos etc).

    Please help me get over this..Thanks.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    I am not in habbit of opening each and every link that i come across in net.

    Comment

    • zonar00
      New Member
      • Oct 2007
      • 16

      #3
      Originally posted by debasisdas
      I am not in habbit of opening each and every link that i come across in net.
      u must be kidding right..... i have posted the same link to other forums noone was probably as pessimistic as your are.

      Comment

      • azimmer
        Recognized Expert New Member
        • Jul 2007
        • 200

        #4
        Originally posted by zonar00
        http://img100.imagesha ck.us/my.php?image=sq loi8.png

        (please refer this first before proceeding)

        I want a SQL query that satisfies the following results:-

        Question# I want to count the rows where the client + server IP remain same over a particular # of entries like 10,20 and etc.
        E.g 1-4 is a pattern where both client and server ip have remain same. I want a count of that.

        Sub-Question# Secondly, i wanna retrieve only the most recent record .The pattern which was prevalent in the time b/w 12:22 to 1:00 is irrelevent i want the next query to execute with the current time.

        I used SQLdata reader but it is being unable to retrieve
        me the exact count i require due to inherent restriction that comes
        with the scope of this method. I cannot use it DataGrid because
        im using a command application(dos etc).

        Please help me get over this..Thanks.
        Would it be possible to modify the data structure? I mean the first thing I would need is a running count column for each row. Do you use 2005 or 2000? (2005 has a new RANK() function that can be used to this end w/o having to modify the data structure.) BTW: Does "Time" contain dates as well? (So that we can handle wrap-arounds.)

        Then: I suppose from the nature of the data that ClientIP/ServerIP combinations can "come back" at a later time (i.e. the same IPs can be assigned after a while -- whereas in the meantime either or both are different). I also assume that separate counts are needed for each such run. Please, verify these assumptions.

        Comment

        Working...