
December 4th, 2003, 04:31 PM
|
|
Junior Member
|
|
Join Date: Dec 2003
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
Joining tables to return top N linked records
I am joining 2 tables that have a 1-to-Many relationship (for example Authors to Books). I would like there to be only one row returned per Author & Book combo.
Say,
SELECT
A.Name,
B.PublishedDate,
B.Title
FROM
Authors A
LEFT JOIN Books B ON A.Author = B.Author
but I would like to alter this query so there is only row per author, and the book displayed is the most recently published (B.PublishedDate) or some other criteria -- this is just an example.
I am sure there is an efficient/easy way in SQL to do this, but I can't quite get it.
|