A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
SQL: howto retrieve only the first row?
Joined: Sep 10, 2004
Dec 21, 2007 10:04:00
I have the following table and wonder how can I select all tickets that the FIRST Origin is JFK and code is 873?
In this example I expect only Ticket=1088 to return because ticket 1005 doesn�t start at JFK.
Thanks for any pointers
Joined: Dec 20, 2006
Dec 21, 2007 12:37:00
very untested statement
select t1.ticket from mytable t1 where t1.origin = 'JFK' and t1.code = 873 and not exists ( select 1 from mytable t2 where t2.ticket = t1.ticket and t2.code = t1.code and t2.id < t1.id )
OCUP UML fundamental
I agree. Here's the link:
- it saves me about five hours per week
subject: SQL: howto retrieve only the first row?
criteriaFind with java.util.regex
Flight and segment
Do you have what it takes to be President?
Problem in MDB instance !!! Help Needed
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013