Gossamer Forum
Home : General : Databases and SQL :

DISTINCT SQL Problem

Quote Reply
DISTINCT SQL Problem
Hi,

I am trying to remove duplicates from this query, but I need to have the unique identifier column, ID in the query, so the DISTINCT fuction is not working because, the columns that have dupes have unique IDs.

SELECT DISTINCT Course, coursename, ID
FROM t_courses
WHERE (Course = 28447)

The courses with this course number are all showing up, because I can't get rid of the ID column in the query.

Any ideas how to return all three columns with the Distinct working off the course field?

ThanksUnsure
Quote Reply
Re: [dtkelly72] DISTINCT SQL Problem In reply to
I've moved this thread, please try and post in the appropriate forum. Thanks!

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [dtkelly72] DISTINCT SQL Problem In reply to
Look up MIN/MAX functions and they should help you with your query.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [dtkelly72] DISTINCT SQL Problem In reply to
Hi

try

Select * From t_course

Where ID Not in (

Select Max(ID) From t_course Group By Course, Coursename

Having Count(*) > 1)

Dregs2