I wanted to run a query where I will get all the fields where one field is unique.I tried this
Select * from announcements where title = SELECT distinct title
FROM announcements;
But it’s not working. Can anyone please help me out here.
I wanted to run a query where I will get all the fields where one field is unique.I tried this
Select * from announcements where title = SELECT distinct title
FROM announcements;
But it’s not working. Can anyone please help me out here.
4
Answers
Thanks all. I got what I was looking for
This query:
returns all the unique titles.
Use it with the operator
IN
:Try use round brackets
Like:
Select * from announcements where title in (SELECT distinct title
FROM announcements);