I have two tables: a header table H and a description table D (with multiple records for each header record). I need to pick all header records and get a description for each of them from the description table.
The complication is that I have to pick the first description from the description table for each header record.
If I do SELECT * FROM H INNER JOIN D ON H.TRANS_ID = D.TRANS_ID, I naturally get multiple results returned for each header record (each with a different description).
Is there a way to achieve what I need to do in one SQL statement without using cursors or stored procedures?
Thanks.
The complication is that I have to pick the first description from the description table for each header record.
If I do SELECT * FROM H INNER JOIN D ON H.TRANS_ID = D.TRANS_ID, I naturally get multiple results returned for each header record (each with a different description).
Is there a way to achieve what I need to do in one SQL statement without using cursors or stored procedures?
Thanks.