를 I 귀하의 요구 사항 설명에서 이것이 귀하가 필요로하는 질문임을 이해했습니다.
select * from table a where a.value>0
// This returns all rows that have values equal to 1. In your case
john monday cleaner 1
peter monday cleaner 1
mark monday cleaner 1
and a.user not in
(select b.user from table b where b.value=0)
// This would check that the users in the above 3 rows do not have any rows in the
result of the select with value =0
john monday cleaner 0
mark monday cleaner 0
//Here it has 2 rows with value = 0 and "and a.user not in" would esnure that from
//the first 3 rows, only those users are selected who are not fetched in the 2 rows
//given above.
그래서 당신은 U이 필요로 정확히 이잖아, 쿼리
select * from table a where a.value>0
and a.user not in
(select b.user from table b where b.value=0)
peter monday cleaner 1 // Result.
내 생각을 실행할 때.
사용 된 SQL 쿼리를 보자. – Andy