I am trying to select rows from a table with duplicates in one column, but also restrict the rows based on another column. It seems to be working incorrectly.
select Id,Terms from QueryData where Track = 'Y' and Active = 'Y' group by Id,Terms having count(Terms) > 1
If I delete where it works fine, but I need to limit it to only these lines.
ID Terms Track Active 100 paper YY 200 paper YY 100 juice YY 400 orange NN 1000 apple YN
therefore, ideally, the query should return the first 2 rows.
source share