I have a table with a unique id and a column with a subject field. I want to select the id where the subject field is distinct. How do I do that?
// Thanks Henrik
I guess you want to show only the ID's of those records that have a unique subject?
SELECT id, subject FROM table GROUP BY subject HAVING count(*) = 1;
Thanks, with your help I came to my result through this;
SELECT id, subject FROM table GROUP BY subject HAVING count(*) > 1;
Thanks again!
you can also use the key word DISTINCT
" select DISTINCT * from so and so where sos and so..."
No you can't. DISTINCT and GROUP BY are very different.