I have two queries having same columns, 1 returning 3 rows and other returning 2 rows. While I join this two query I am able to get only 2 rows. How can I get three rows with not matching record as null in sql server?
Query1:
Select UDA.production_date_T, Count (WO.order_state) AS 'cntplan'
From WORK_ORDER WO
INNER JOIN UDA_Order UDA ON UDA.object_key = WO.order_key
group by UDA.production_date_T) TBL1
Query2:
Select UDA.production_date_T, Count (WO.order_state) AS 'ACTUAL'
From WORK_ORDER WO
INNER JOIN UDA_Order UDA
ON UDA.object_key = WO.order_key
WHERE WO.order_state = 'BOOKED'
GROUP BY UDA.production_date_T
My desired Output is:
production_date_T cntplan ACTUAL
2019-04-26 22 4
2019-05-03 4 NULL
2019-09-05 19 0