Displaying specific data from the database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • smitanaik
    New Member
    • Oct 2007
    • 26

    Displaying specific data from the database

    This are my database columns
    1)Ipaddress(add ress of client machine) 2)data received (content downloaded from server)3)url(si tes accesssed by the users)






    I want to display Ipaddresses based on highest data received.that is first i will have to sum the data recceived by particular ip address and then display the ip address that has received highest data.

    [code=oracle]

    select ip_address,sum( data_received) from log group by ip_address,data _received ORDER BY data_received desc ;

    [/code]


    when i try this the output I get is wrong not all the data is in descending order.
    Last edited by amitpatel66; Apr 7 '08, 05:04 AM. Reason: code tags
  • mafaisal
    New Member
    • Sep 2007
    • 142

    #2
    Hello

    Try This

    Code:
    Select ip_address,Data_rec From (select ip_address,sum(data_received)  as Data_rec from log group by ip_address,data_received) as Dt Order By Data_rec  Desc
    In here i think in group by option data_received is not needed
    Try with that & without that to got ur output

    Faisal


    Originally posted by smitanaik
    This are my database columns
    1)Ipaddress(add ress of client machine) 2)data received (content downloaded from server)3)url(si tes accesssed by the users)






    I want to display Ipaddresses based on highest data received.that is first i will have to sum the data recceived by particular ip address and then display the ip address that has received highest data.


    select ip_address,sum( data_received) from log group by ip_address,data _received ORDER BY data_received desc ;

    when i try this the output I get is wrong not all the data is in descending order.
    Last edited by mafaisal; Apr 5 '08, 04:37 PM. Reason: Added more

    Comment

    • amitpatel66
      Recognized Expert Top Contributor
      • Mar 2007
      • 2358

      #3
      A small change to your query :

      [code=oracle]

      select ip_address,sum( data_received) sum_data from log group by ip_address ORDER BY sum_data desc ;

      [/code]

      The above query should give you correct results.

      Comment

      Working...