I am attempting to Full Outer Join these two Select statements on Microsoft SQL Server 2014 so that I have a table that includes Date, Major Tickets, and Minor Tickets. and it says that there is a syntax issue near the "on" in the Outer Join clause. I was wondering if there is any way to resolve this issue?
Select #mytable7.Date,#mytable9.Date, #mytable7.[Major Tickets],#mytable9.[Minor Tickets]
from
(select convert(VARCHAR, EventDate1, 112) as Date, Count(FltNo1) as [Major Tickets]
from TicketCoupons
Where PaxNo='1'
and EventDepart = 'DET'
and EventDate1 >= '20160601'
and EventDate1 <= '20160709'
group by convert(VARCHAR, EventDate1, 112)) as #mytable7
Full Outer Join
(Select Date, [Minor Tickets]
from
(select convert(VARCHAR, EventDate1, 112) as Date, Count(FltNo1) as [Minor Tickets]
from TicketCoupons
Where PaxNo='1'
and EventArrive = 'DET'
and EventDate1 >= '20160601'
and EventDate1 <= '20160709'
group by convert(VARCHAR, EventDate1, 112)) as #mytable9
on #mytable7.Date = #mytable9.Date
order by #mytable7.Date
I'm very new to SQL so if this is completely off, or not possible, I apologize in advance.