I have the following table:
ID | JobID | Data | ResultType
---------------------------------
1 | 12345 | XXXX | 0
2 | 12345 | YYYY | 1
3 | 23456 | A
Something like
select * from jobs where jobId not in
(select jobId from jobs where resultType = 1)
SELECT JobID FROM <TableName> WHERE ResultType <> 1
Is this what you want ???
Another way (not tested):
SELECT JobId FROM Jobs GROUP BY jobId HAVING max(ResultType) = 0
Use this query:
SELECT JobID
From table1 a
WHERE NOT EXISTS
(SELECT 1 FROM table1 b WHERE b.JobID = a.JobID AND b.ResultType = 1)