有人可以协助查询出了什么问题。错误是 信息156,第15级,状态1,第6行 关键字“FROM”附近的语法不正确。
SELECT TOP 1000 [SessionId]
WHERE [FONumber] = '156101'
AND [ShipTo] = '868257'
AND [OrderDate] = '2016-07-11'
FROM [NFConnect].[dbo].[tblOrders]
答案 0 :(得分:2)
正确的语法是select ... from ..where
:
SELECT TOP 1000 [SessionId]
FROM [NFConnect].[dbo].[tblOrders]
WHERE [FONumber] = '156101'
AND [ShipTo] = '868257'
AND [OrderDate] = '2016-07-11'
答案 1 :(得分:0)
FROM
应该在WHERE
条款之前:
SELECT TOP 1000 [SessionId]
FROM [NFConnect].[dbo].[tblOrders]
WHERE [FONumber] = '156101'
AND [ShipTo] = '868257'
AND [OrderDate] = '2016-07-11'
答案 2 :(得分:0)
您必须在FROM
WHERE
SELECT TOP 1000 [SessionId]
FROM [NFConnect].[dbo].[tblOrders]
WHERE [FONumber] = '156101'
AND [ShipTo] = '868257'
AND [OrderDate] = '2016-07-11'
您可以在enter link description here
检查t-sql的语法SELECT [ ALL | DISTINCT ]
[TOP ( expression ) [PERCENT] [ WITH TIES ] ]
< select_list >
[ INTO new_table ]
[ FROM { <table_source> } [ ,...n ] ]
[ WHERE <search_condition> ]
[ <GROUP BY> ]
[ HAVING < search_condition > ]