I have a query:
SELECT Content.content_name, Language2.Name, Language2.language_id,
Content.id, Content.content_description,
FROM Language AS Language2
LEFT JOIN contents AS Content ON (Language2.language_id = Content.language_id)
How do I select only the distinct content_name?
You do this:
So why does this not answer your question?
Let’s consider the following data (just the first two columns):
SELECT DISTINCTimplies you only want one row, but what do you want for Name?What you need to do is rewrite the code to use
GROUP BYand pick the appropriate aggregate function for the other columns:Now, likely this does not produce what you want either, but one thing is for certain, you can not trick the database engine to just “pick one of the rows to return, I don’t care which one.”