SQL サーバーで正常に実行された SQL ステートメントがありましたが、vb.net に貼り付けると構文が正しくありませんでした。不適切な構文は、キーワード'.'
, 'endfrom'
andの近くにありました'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"