我有一個sql語句在sql server上成功運行,但在vb.net上粘貼時出現語法問題。不正確的語法靠近關鍵字'.'
,'endfrom'
和'group'
。關鍵字附近的語法不正確
sql = "select distinct y.supplierID, y.Name," & _
"StatusDesc=CASE when y.status='N' then 'NEW' " & _
"when y.status='B' then 'BLACKLISTED'" & _
"when y.status='Q' then 'QUALIFIED'" & _
"when y.status='R' then 'REJECTED' end , " & _
"FlowStatusDesc = CASE when y.flowstatus='RC' then 'UNDER REVIEW'" & _
"when y.flowstatus='PE' then 'POTENTIAL EXCLUSIVE'" & _
"when y.flowstatus='PO' then 'POTENTIAL ORDINARY' ELSE '' end," & _
"orderno=case when y.status='N' and y.flowstatus='' then '1'" & _
"when y.status='N' and y.flowstatus<>'' then '2' " & _
"when y.status='R' and y.flowstatus='' then '3'" & _
"when y.status='R' and y.flowstatus<>'' then '4'" & _
"when y.status='Q' and y.flowstatus='' then '5'" & _
"when y.status='Q' and y.flowstatus<>'' then '6'" & _
"when y.status='B' and y.flowstatus='' then '7' " & _
"when y.status='B' and y.flowstatus<>'' then '8' else '9' end " & _
"from (select x.supplierID, x.Name,x.Status,x.FlowStatus,x.AddWho" & _
"from dbo.AP_Supplier x where x.AddWho IN (Select distinct b.UserID from dbo.SC_UserRole a left join dbo.SC_UserRole b ON a.RoleID=b.RoleID where [email protected])" & _
"group by x.supplierID,x.Name,x.Status,x.FlowStatus,x.AddWho)y " & _
"group by y.supplierID,y.name,y.status, y.flowstatus" & _
"order by orderno"
您有正確的答案,請檢查您的所有空缺查詢。 – Steve