T-Sql
My code is pulling all records where field2 = 0. In tableA are sales orders. Each sales order may have multiple records. Those multiple records will contain either a 0 or 1 in field2. What I need is to only pull from the many records for a sales order (field1) only ONE record where field2 = 0 even if there are more than one record for field1 where field2 = 0. Does not matter which record, I just need to know that there is at least 1 record for the same sales order where field2 = 0.
Thanks
Code:
Select field1, field2
from tableA
where field2 = 0
Present records:
[tt]
field1 field2
778899 0
778899 0
778899 1
882222 1
882222 0
998888 0
[/tt]
Desired results:
[tt]
field1 field2
778899 0
882222 0
998888 0
[/tt]