【发布时间】:2016-07-14 16:59:46
【问题描述】:
我有一个查询,其中同时显示了报告名称和报告 ID 这仅适用于预先检查报告的情况。这些值填充在数据网格中。如果未选中报告,则仅显示名称。我尝试使用 UPDATE 关键字,但一直遇到语法错误。我知道对查询的微小更改很简单,但是当报告未选中或基本上reportvisible 为0 时,我尝试显示reportid 时遇到了麻烦。我如何解决此问题以显示reportid,无论它是否是检查与否?
valsql1 = "SELECT c.ReportID, c.COMPANYID, rl.REPORTNAME
FROM CompanyReportListTable c
right join ReportList rl on c.reportid = rl.ReportID
and reportvisible = 1
and CompanyID =" & DropDownList1.SelectedValue & "
where rl.ReportID in (
Select ReportID
from ReportList
where ReportVisible = 1
)
order by ReportName"
【问题讨论】:
-
为什么不直接从join语句中删除
and reportvisible = 1? -
原因是不要失去每家公司的适当报告的准确性。我尝试从 join 语句中删除 reportvisible。当我运行该程序时,未检查的报告名称旁边仍然没有报告 ID。我检查未检查的报告也没有显示报告 ID。