Results 1 to 2 of 2
Jul 21, 2002, 23:55 #1
- Join Date
- Sep 2001
- 0 Post(s)
- 0 Thread(s)
is a subselect appropriate here? if so how?
hi again everyone i've another query for all you grizzled db veterans around here
in english, what i'm trying to do is to determine the row with the maximum no. of no_beers and no_ciders (purely imaginary names to mask the real names... i don't really have a beer database )... from this row, i want to further know the difference between 2 other datetime fields (time_start and time_end)... i'm not sure how to accomplish that and have never written a join (beyond the simple joins using where clauses) nor a subselect (which wouldn't be appropriate here i think)...
here's what i've:
SELECT some_no, MAX(no_beers + no_ciders) AS longest FROM mydb.mytbl WHERE vin=27723 GROUP BY some_no
SOME_N LONGEST --------- ---------------- 204 16 205 12
<edit> i'm using oracle, forgot to add </edit>
thanks a lot!
some_n | NUMBER(3) no_beers | NUMBER(2) no_ciders | NUMBER(2) time_start | DATE time_end | DATE
Jul 22, 2002, 05:15 #2
- Join Date
- Jul 2002
- Toronto, Canada
- 49 Post(s)
- 1 Thread(s)