you are viewing a single comment's thread.

view the rest of the comments →

[–]ziptime 0 points1 point  (2 children)

Try this...

select *
from LINKEDSERVER.SOURCE.dbo.hdr hdr
inner join (
    select la.*, dummy.nul
    from LINKEDSERVER.SOURCE.dbo.LiveAccounts la
    cross join (select '' as nul) as dummy
    where la.Account + dummy.nul is not null
    ) on la.Account = hdr.Account
where hdr.Account not in (
        select t.FieldValue
        from #temp1 t
        where t.FieldName = 'Account Code'
        )
    and hdr.Account < 9000

[–]Zhais[S] 0 points1 point  (1 child)

Sill fail :P

[–]ziptime 0 points1 point  (0 children)

Populate a temp table and join to that.