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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Eliminating rows where one column is duplicated 1

Status
Not open for further replies.

rwise2112

MIS
May 26, 2002
138
0
0
CA
Hi,

I'm very new to SQL and have a problem that I can't figure out. I'm using the following SQL query and I need to eliminate records where Tracks.RecordingID is duplicated. It seems the DISTINCT command checks all the records in the row and will not help here.

Code:
SELECT Tracks.TrackTitle, Tracks.RecordingID
FROM Tracks
WHERE (Tracks.TrackTitle) Like "*" & [Track Name:] & "*"
ORDER BY Tracks.RecordingID;

Can anyone help?
Thanks in advance
 
This is one way I can think of. By the way you have missing quotes round the string in the like evaluation.

SELECT max(Tracks.TrackTitle), Tracks.RecordingID
FROM Tracks
WHERE (Tracks.TrackTitle) Like "'*" & [Track Name:] & "*'"
GROUP BY Tracks.RecordingID
ORDER BY Tracks.RecordingID;
 
Thanks,

That did it, but only if I exclude the quotes you say I need. If I include them it returns 0 results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top