SQL DISTINCT query on Multiple Columns
I have a table like this:
Artist Image Title
Smith 2 Country
Smith 5 Town
Doyle 21 Cat
Lawlor 24 Ball
Jones 8 Cheese
Jones 12 Bread
Jones 15 Butter
And I want to set up a DISTINCT Qu开发者_如何学编程ery to return the Artist once - doesn't matter which of the records are returned. This is what I'm looking for:
Artist Image Title
Smith 2 Country
Doyle 21 Cat
Lawlor 24 Ball
Jones 8 Cheese
I am using ASP on a MS Access database.
Any help much appreciated.
Access has FIRST
and LAST
aggregates which return the first or last record as it was entered in chronological order
SELECT Artist, FIRST(Image) AS Image, FIRST(Title) AS Title
FROM table
GROUP BY Artist
精彩评论