I select the data from the table as follows
SELECT DISTINCT clientid,productid,[DATE], (SELECT quantity FROM csv_export c1 WHERE c.clientid=c1.clientid AND c.productid=c1.productid AND c.[DATE]=c1.[DATE]) AS quantity , (SELECT amount FROM csv_export c1 WHERE c.clientid=c1.clientid AND c.productid=c1.productid AND c.[DATE]=c1.[DATE]) AS amount FROM dbo.CSV_Export c WHERE quantity>0 AND amount>=0 And how do I get those records that do not pass the specified conditions, that is, are not unique in the three fields and not quantity> 0 and amount> = 0
update
select distinct clientid,productid,[date], (select quantity from csv_export c1 where c.clientid=c1.clientid and c.productid=c1.productid and c.[date]=c1.[date]) as quantity , (select amount from csv_export c1 where c.clientid=c1.clientid and c.productid=c1.productid and c.[date]=c1.[date]) as amount, (select id from csv_export c1 where c.clientid=c1.clientid and c.productid=c1.productid and c.[date]=c1.[date]) as id from dbo.CSV_Export c where quantity>0 and amount>=0 The question now is how to pull out only the entries with the id field from here.
update1:
These are the original data.
With a minimum amount of code from this table, it is necessary to transfer to table A — data by condition — the record must be unique in the set of client-product-date fields; - number> 0 and sum> = 0 in table B - data where this condition is not met

group by и проверку having count(1) > 1) - Mike