可以引用SQL语句的FROM子句中列出的多个表 [英] could refer to more than one table listed in the FROM clause of your SQL statement

查看:1089
本文介绍了可以引用SQL语句的FROM子句中列出的多个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在SQL Server Management Studio中运行此查询时,它工作正常,但是当我尝试在VB.net中填充网格时,它会给我以下错误



可以引用SQL语句的FROM子句中列出的多个表



以下是查询:



When I run this query in SQL Server Management Studio it works fine, but when I try to populate a grid in VB.net it gives me the following error

"could refer to more than one table listed in the FROM clause of your SQL statement"

Below is the query:

SELECT Distinct T1.QID, T1.Title, T1.Vendorid, T1.Severity, T1.Published, Total
FROM Missing_Patch_Table T1,
(
    SELECT QID, COUNT (IP) as Total
    FROM Missing_Patch_Table
    Group by QID
) as T2
where T1.QID = T2.QID
Order by Total desc, Severity, QID;







有人可以帮我这个

推荐答案

这意味着其中一个字段您尚未指定表名存在于两个表中的位置。它可以是Total,Severity或QID。只要把T1。或T2。在每个字段的前面,即使在ORDER BY子句中也应该修复错误。
It means one of the fields where you haven't specified the table name exists in both tables. It could be Total, Severity, or QID. Just put T1. or T2. in front of each field, even in the ORDER BY clause and that should fix the error.


这篇关于可以引用SQL语句的FROM子句中列出的多个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆