Results 1 to 2 of 2

Thread: help with sql

  1. #1
    Join Date
    Dec 2003
    Location
    usa
    Posts
    4

    Unanswered: help with sql

    i'm trying to find peak connections for each day

    select max(connections)as peak from peak_connections
    where account_id ='1909' and incident_time between '2004-05-25' and '2004-05-26'
    -- the above query returns only the peak for 5/25.

    how do I write it so that when i execute the query it will return the peak for all dates.
    some sample data is provided below.

    thanks for your help.

    May 25, 2004 1
    May 25, 2004 0
    May 25, 2004 1
    May 25, 2004 0
    May 25, 2004 1
    May 25, 2004 2
    May 25, 2004 2
    May 25, 2004 3
    May 25, 2004 4
    May 25, 2004 5
    May 25, 2004 4
    May 25, 2004 5
    May 25, 2004 6
    May 25, 2004 7
    May 25, 2004 8
    May 25, 2004 7
    May 25, 2004 8
    May 25, 2004 7
    May 25, 2004 8
    May 25, 2004 7
    May 25, 2004 8
    May 25, 2004 9
    May 25, 2004 10
    May 25, 2004 11
    May 25, 2004 11
    May 25, 2004 12
    May 25, 2004 13
    May 25, 2004 14
    May 25, 2004 13
    May 25, 2004 12
    May 25, 2004 10
    May 25, 2004 9
    May 25, 2004 8
    May 25, 2004 7
    May 25, 2004 6
    May 25, 2004 5
    May 25, 2004 4
    May 25, 2004 3
    May 25, 2004 3
    May 25, 2004 3
    May 25, 2004 4
    May 25, 2004 3
    May 25, 2004 4
    May 25, 2004 5
    May 25, 2004 6
    May 25, 2004 7
    May 25, 2004 8
    May 25, 2004 8
    May 25, 2004 9
    May 25, 2004 8
    May 25, 2004 7
    May 25, 2004 6
    May 25, 2004 7
    May 25, 2004 6
    May 25, 2004 7
    May 25, 2004 6
    May 25, 2004 7
    May 25, 2004 6
    May 25, 2004 5
    May 25, 2004 5
    May 25, 2004 4
    May 25, 2004 3
    May 25, 2004 2
    May 25, 2004 1
    May 26, 2004 1
    May 26, 2004 0
    May 26, 2004 1
    May 26, 2004 2
    May 26, 2004 1
    May 26, 2004 1
    May 26, 2004 1
    May 26, 2004 2
    May 26, 2004 3
    May 26, 2004 4
    May 26, 2004 3
    May 26, 2004 4
    May 26, 2004 3
    May 26, 2004 4
    May 26, 2004 5
    May 26, 2004 6
    May 26, 2004 7
    May 26, 2004 8
    May 26, 2004 9
    May 26, 2004 9
    May 26, 2004 8
    May 26, 2004 7
    May 26, 2004 6
    May 26, 2004 5
    May 26, 2004 4
    May 26, 2004 3
    May 26, 2004 4
    May 26, 2004 3
    May 26, 2004 4
    May 26, 2004 4
    May 26, 2004 5
    May 26, 2004 3
    May 26, 2004 2
    May 26, 2004 1
    May 27, 2004 1
    May 27, 2004 1
    May 27, 2004 2
    May 27, 2004 1
    May 27, 2004 2
    May 27, 2004 2
    May 27, 2004 1
    May 27, 2004 2
    May 27, 2004 3
    May 27, 2004 2

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    select incident_time, max(connections)as peak from peak_connections
    where account_id ='1909' and incident_time between '2004-05-25' and '2004-05-26'
    group by incident_time


    Books Online, anyone?
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •