Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sybase Top N in Subquery

Status
Not open for further replies.

CMiner

MIS
Oct 19, 2007
2
US
I know SET ROWCOUNT won't work here, I'm looking for a workable solution.

Two database tables linked in a one-to-many relationship.

I need to get the data from table 1, and a single field from table 2 based on the earliest date from a date field.

In SQL it would be easy:

SELECT Table1.*, (SELECT TOP 1 datefield FROM Table2 WHERE Table2.linkfield = Table1.linkfield ORDER BY datefield) FROM Table1

I need some way to get the same sort of data from a Sybase database.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top