4
我創建了3個查詢到我的Firebird數據庫。合併3火鳥查詢
1 - 獲取日期
select
distinct oh.FAMILY
from
TRACKCODE_SUMMARY ts,
ORDER_HEAD oh
where
oh.AMF_NUM = ts.AMF_NUM
and ts.DATE_INDUCTION >= '2017-04-06';
2所有家庭 - 獲取的日期和家庭
select
count(*) AS Produced
from
trackcode_summary ts,
order_head oh
where
ts.AMF_NUM = oh.AMF_NUM
and ts.date_induction >= '2017-04-06'
and oh.FAMILY like 'TULIP15BROAD';
3生產計數 - 獲取的日期和家庭
select
count(*) AS Failed
from
trackcode_summary ts,
order_head oh
where
ts.AMF_NUM = oh.AMF_NUM
and ts.date_induction >= '2017-04-06'
and (ts.emr >= 1 or ts.current_status = 200)
and oh.FAMILY like 'TULIP15BROAD';
失敗計數
這3個查詢完美分離。我需要合併成一個查詢。
我該怎麼做?