Re: need SQL assistance with a few selects

2002-05-04 Thread Bill Easton
See section 3.5.4 of the manual. The example there can be adapted to give you the date of the max or min disk size in one query. You have it right for MAX and MIN; there is also an AVG function. >From the manual: ``Can it be done with a single query?'' Yes, but only by using a quite inefficie

RE: need SQL assistance with a few selects MORE INFO

2002-05-03 Thread Jay Blanchard
[snip] 2. The date of max disksize and the date of min disksize...in one query...if that's possible. [/snip] mysql> select RunDate, -> MAX(IF(ClientName = 'ABC INC', DiskSize, '')) AS ABC, -> MAX(IF(ClientName = 'Eat at Joe', DiskSize, '')) AS Joe, -> MAX(IF(ClientName = 'The Hop', Di

RE: need SQL assistance with a few selects

2002-05-03 Thread Jay Blanchard
[snip] 1. An average disksize for each client, date doesn't matter. The result I'd like to see would be something like: "ABC INC","1.8" "Joe's Restaurant","1.2" [/snip] mysql> SELECT CLIENT_NAME, AVG(DISK_SIZE) AS Average, MIN(DISK_SIZE) AS Minimum, MAX(DISK_SIZE) AS Maximum -> from table <--