【发布时间】:2011-11-20 01:44:12
【问题描述】:
我曾经在side select子句中编写select子句以避免加入from子句。但我担心这是一种很好的编码实践,否则会降低数据库性能。下面是包含多个表的查询,但我使用嵌套选择子句编写了它,没有任何连接语句。如果我犯了任何错误或者没关系,请告诉我。此刻,我得到了准确的结果。
SELECT * ,
(select POrderNo from PurchaseOrderMST POM
where POM.POrderID=CET.POrderID)as POrderNo,
(select SiteName from SiteTRS ST where ST.SiteID=CET.SiteID)as SiteName,
(select ParticularName from ParticularMST PM where
PM.ParticularID=CET.ParticularID)as ParticulerName
FROM ClaimExpenseTRS CET
WHERE ClaimID=@ClaimID
【问题讨论】:
标签: sql-server-2008