Feb 13 2023 12:43 AM
i have a table named table1 where it shows
date, employee#, transaction#
1/1/2022 5656 123
2/1/2022 6565 321
and i would like to write sql script where employee done 2 transaction in same day
for example transaction numbers are 123 and 321
can anyone help
thank you!!
Feb 13 2023 10:26 PM
@ArarA911 , That's really less on information.
Next time, please post table design as DDL, some sample data as DML statement and the expected result.
This should work for you, a simple aggregation with a filter on the count:
SELECT date, employee, count(*) as cnt
FROM table1
GROUP BY date, employee
HAVING COUNT(*) = 2