General information
Forum:
Microsoft SQL Server
Why not try the query in two parts. Do the first 2 inner joins and then union it to the third.
FROM holding thold
inner join security
on thold.securityid = security.securityid
inner join portfolio
on thold.portid = portfolio.portid
WHERE thold.date = @asofdate
union ( select ... from holding
left join holding yhold
on (thold.portid = yhold.portid and thold.securityid = yold.securityid
WHERE yhold.date = @prevdate)
into ...
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only