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 :D)... 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:
and this is what it turns up:
MAX(no_beers + no_ciders) AS longest
now what i want is to find out the difference between the time_start and time_end fields of the row with SOME_N = 204 and LONGEST = 16
<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