我有一个连接大约 5 个表并显示所有结果的查询。记录显示在 Web 应用程序上,它应该有大约 70000 个条目,但是当我执行此连接时,它仅在 MSSQL 2008 中显示 51000 个条目。我想知道如何操作连接函数来显示所有 70000 个条目,或者添加外部连接或内部连接?我对连接功能没有太多经验,希望有人编辑我的查询以显示这 5 个表中的所有条目。我知道这是专业程序员的快速解决方案,我提前感谢您的时间和精力!干杯
现有查询:
select SerialNum as [Serial Number],ts_sitename As Site,(case m.Scratched
when 0 then 'Live'
when 1 then 'Free'
END) as Status, Note as Comment,
SUBSTRING(cast(EffectiveDate as char), 1, 8) AS [Effective Date Added],
SUBSTRING(cast(EffectiveDate as char), 10, 6) AS [Effective Time Added],
SUBSTRING(cast(ScratchedDate as char), 1, 8) AS [Scratched Date],
SUBSTRING(cast(ScratchedDate as char), 10, 6) AS [Scratched Time],
SUBSTRING(cast(ChangedPurgeDate as char), 1, 8) AS [Purge Date],
SUBSTRING(cast(ChangedPurgeDate as char), 10, 6) AS [Purge Time],
fl_filename as Dataset, hs_hostname,UserCode
from (((((Media m join TheSites_tab s on m.SiteId = s.ts_sitenum)
join MediaGenT g on m.MediaId = g.mg_medianum)
join TheHosts_tab h on mg_hostnum = h.hs_hostnum)
join TheFiles_tab f on mg_filenum = f.fl_filenum)
join [User] u on mg_usernum = u.UserId)
join Note n on m.NoteId = n.NoteId
where Destroyed = '0';