有人可以協助查詢有什麼問題。錯誤是 Msg 156,級別15,狀態1,行6 關鍵字'FROM'附近的語法不正確。SQLQuery錯誤
SELECT TOP 1000 [SessionId]
WHERE [FONumber] = '156101'
AND [ShipTo] = '868257'
AND [OrderDate] = '2016-07-11'
FROM [NFConnect].[dbo].[tblOrders]
有人可以協助查詢有什麼問題。錯誤是 Msg 156,級別15,狀態1,行6 關鍵字'FROM'附近的語法不正確。SQLQuery錯誤
SELECT TOP 1000 [SessionId]
WHERE [FONumber] = '156101'
AND [ShipTo] = '868257'
AND [OrderDate] = '2016-07-11'
FROM [NFConnect].[dbo].[tblOrders]
的FROM
768,16是WHERE
條款之前:
SELECT TOP 1000 [SessionId]
FROM [NFConnect].[dbo].[tblOrders]
WHERE [FONumber] = '156101'
AND [ShipTo] = '868257'
AND [OrderDate] = '2016-07-11'
正確的語法是select ... from ..where
:
SELECT TOP 1000 [SessionId]
FROM [NFConnect].[dbo].[tblOrders]
WHERE [FONumber] = '156101'
AND [ShipTo] = '868257'
AND [OrderDate] = '2016-07-11'
您以前使用FROM
WHERE
SELECT TOP 1000 [SessionId]
FROM [NFConnect].[dbo].[tblOrders]
WHERE [FONumber] = '156101'
AND [ShipTo] = '868257'
AND [OrderDate] = '2016-07-11'
您可以檢查T-SQL這裏enter link description here
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> ]
語法