두 개의 다른 쿼리에서 얻은 결과를 필터링하여 총 수를 얻고 싶습니다. 아래는 두 가지 질문입니다.첫 번째 쿼리와 두 번째 쿼리의 결과를 빼는 방법
Query 1
select count(*)
from table1 oow
where oow.status='completed'--134 records
Query 2
select count(*)
from table2 oow
join #temp re
on oow.order=re.order
where oow.status='completed'--77 records
원하는 결과는 두 개의 즉, 134-77 = 57을 뺍니다. 어떻게 그것을 sybase에서 달성 할 수 있습니까?
SELECT
(select count(*)
from table1 oow
where oow.status='completed')
-
(select count(*)
from table2 oow
join #temp re
on oow.order=re.order
where oow.status='completed')
정말 고마워요. – Alpesh003