SO3229185

0

Please login or register to vote for this query.

(click on this box to dismiss)

Trying to combine implicit and explicit joins

Stack Overflow

Q&A for programmers

-- SO3229185
-- Trying to combine implicit and explicit joins

CREATE TABLE #Period (
PeriodID INT NOT NULL,
PeriodQuarter INT NOT NULL,
PeriodYear INT NOT NULL
)

CREATE TABLE #Member (
Name VARCHAR(50) NOT NULL,
AuditTypeID INT NOT NULL
)

CREATE TABLE #Audits (
AuditID INT NOT NULL,
PeriodID INT NOT NULL
)

select  P.PeriodID,
        P.PeriodQuarter,
        P.PeriodYear,
        M.Name,
        M.AuditTypeId,
        A.AuditId
from #Period P CROSS JOIN #Member M

LEFT JOIN #Audits A 
ON P.PeriodId = A.PeriodId

WHERE 
    P.PeriodID > 29 AND P.PeriodID < 38
    AND M.AuditTypeId in (1,2,3,4)
order by M.Name

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results
:records returned in :time ms:cached