HonestCon
HonestCon

Reputation: 33

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 Query 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.

Upvotes: 3

Views: 2306

Answers (1)

Martin Smith
Martin Smith

Reputation: 453898

Access has FIRSTand 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

Upvotes: 2

Related Questions