please correct the below sql query. Here columns are dynamic. So i have to user * only. Query:
SELECT * FROM test_table WHERE Id IN ('abc','123') GROUP BY Id HAVING COUNT(*) > 1
please correct the below sql query. Here columns are dynamic. So i have to user * only. Query:
SELECT * FROM test_table WHERE Id IN ('abc','123') GROUP BY Id HAVING COUNT(*) > 1
If you want to select all the column corresponding to the selected IDs:
select *
from test_table
where id in (
select id
from test_table
where Id in ('abc','123')
group by Id
having COUNT(*) > 1
)
For only Id:
select id
from test_table
where Id in ('abc','123')
group by Id
having COUNT(*) > 1