Below is a simple SELECT statement that I am building which is supposed to include two derived tables...but I believe the syntax is wrong....or something else is messed up somewhere.
SELECT a.SRR_Total, b.WO_Total, b.dateCreated, b.franchiseID
FROM ((select COUNT(srvcReqRefID) as SRR_Total, dateCreated, franchiseeID
from dbo.SVC_REQUEST
group by dateCreated, franchiseeID) as a,
(select COUNT(workorderID) as WO_Total, dateCreated, franchiseID
from dbo.WRK_ORDER
group by dateCreated, franchiseID)as b)
WHERE a.dateCreated = b.dateCreated and a.franchiseeID = b.franchiseID
ORDER BY b.dateCreated ASC
Can someone please show me what I am doing wrong...i have been away from SQL for awhile.
SELECT a.SRR_Total, b.WO_Total, b.dateCreated, b.franchiseID
FROM ((select COUNT(srvcReqRefID) as SRR_Total, dateCreated, franchiseeID
from dbo.SVC_REQUEST
group by dateCreated, franchiseeID) as a,
(select COUNT(workorderID) as WO_Total, dateCreated, franchiseID
from dbo.WRK_ORDER
group by dateCreated, franchiseID)as b)
WHERE a.dateCreated = b.dateCreated and a.franchiseeID = b.franchiseID
ORDER BY b.dateCreated ASC
Can someone please show me what I am doing wrong...i have been away from SQL for awhile.