我有一个在 sql server 上成功运行的 sql 语句,但是在粘贴到 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 a.UserID=@User)" & _
"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"