I have a table say XYZ, there are three entries for each entity of the column say 'a' and I want to find out if there are more than 3 entries for those entities in the column.
column:
a b c
123
123
123
sol
sol
sol
456
456
456
Here I want to know if I have more than 3 entries for 123 or sol or 456 in the tab
SELECT a, count(a) from YOURTABLE group by a having count(a) > 2
Since you didn't provide a table name i just placed "YOURTABLE" there.
Just try somthing like this, i did not test the sql but you understand the ideea
select a
from your_table
where
(select count(*)
from your_table
where a = 'your_entity') > 3
精彩评论