下面的SQL,在SQL SERVER中运行没问题,但在ACCESS中运行时提示错误
能帮忙看一下以下SQL语句,在ACCESS中哪个地方有语法错误(提示语法错误,操作符丢失),非常谢谢!SelectDISTINCTT.INVOICE_NO,C.PPROD...
能帮忙看一下以下SQL语句,在ACCESS中哪个地方有语法错误(提示语法错误,操作符丢失),非常谢谢!
Select DISTINCT T.INVOICE_NO ,C.PPROD AS Material_No,T.Material_Desc,T.Count_CT,
T.Net_Weight,T.Gross_Weight,T.Carton,T.Pallet,T.InnerBox_No,A.CT,A.INVOICE_NO,T1.Lot_No,A.Destination,C.NPROD AS Material_Desc,T1.Quantity,A.Barcode AS Barcode_No
From (Select distinct A.INVOICE_NO ,A.CT,A.Material_No,A.Material_Desc,A.Count_CT,
A.Net_Weight,A.Gross_Weight,A.Carton,A.Pallet,A.InnerBox_No,
switch(InnerBox_No='9000',A.CT,InnerBox_No LIKE '80%',A.CT,LEN(InnerBox_No)=1,RTRIM(A.CT)+'T0'+A.InnerBox_No,True,RTRIM(A.CT)+'T'+A.InnerBox_No) AS CT_NEW
From PackingList A) T
LEFT JOIN InvoiceInfo A ON (T.CT_NEW=A.CT) and (T.INVOICE_NO=A.INVOICE_NO)
LEFT JOIN BarcodeInfo B ON (A.Barcode=B.PBAR3)
LEFT JOIN ProductInfo C ON (B.PPROD=C.PPROD)
LEFT JOIN
(SELECT DISTINCT A.Barcode,T.LOT_NO,SUM(QLOT) AS Quantity
FROM
(SELECT DISTINCT
switch(Barcode LIKE '%S%',B.PBAR1,Barcode LIKE '%M%',B.PBAR2,True,B.PBAR3 ) AS PBAR,
switch(Barcode LIKE '%S%',B.PLOT1,Barcode LIKE '%M%',B.PLOT2,True,B.PLOT3 ) AS LOT_No
From InvoiceInfo A,BarcodeInfo B) T,InvoiceInfo A,BarcodeInfo B
WHERE T.PBAR=A.Barcode
GROUP BY A.Barcode,T.LOT_NO) T1 ON (A.Barcode=T1.Barcode)
WHERE A.Barcode<>'' 展开
Select DISTINCT T.INVOICE_NO ,C.PPROD AS Material_No,T.Material_Desc,T.Count_CT,
T.Net_Weight,T.Gross_Weight,T.Carton,T.Pallet,T.InnerBox_No,A.CT,A.INVOICE_NO,T1.Lot_No,A.Destination,C.NPROD AS Material_Desc,T1.Quantity,A.Barcode AS Barcode_No
From (Select distinct A.INVOICE_NO ,A.CT,A.Material_No,A.Material_Desc,A.Count_CT,
A.Net_Weight,A.Gross_Weight,A.Carton,A.Pallet,A.InnerBox_No,
switch(InnerBox_No='9000',A.CT,InnerBox_No LIKE '80%',A.CT,LEN(InnerBox_No)=1,RTRIM(A.CT)+'T0'+A.InnerBox_No,True,RTRIM(A.CT)+'T'+A.InnerBox_No) AS CT_NEW
From PackingList A) T
LEFT JOIN InvoiceInfo A ON (T.CT_NEW=A.CT) and (T.INVOICE_NO=A.INVOICE_NO)
LEFT JOIN BarcodeInfo B ON (A.Barcode=B.PBAR3)
LEFT JOIN ProductInfo C ON (B.PPROD=C.PPROD)
LEFT JOIN
(SELECT DISTINCT A.Barcode,T.LOT_NO,SUM(QLOT) AS Quantity
FROM
(SELECT DISTINCT
switch(Barcode LIKE '%S%',B.PBAR1,Barcode LIKE '%M%',B.PBAR2,True,B.PBAR3 ) AS PBAR,
switch(Barcode LIKE '%S%',B.PLOT1,Barcode LIKE '%M%',B.PLOT2,True,B.PLOT3 ) AS LOT_No
From InvoiceInfo A,BarcodeInfo B) T,InvoiceInfo A,BarcodeInfo B
WHERE T.PBAR=A.Barcode
GROUP BY A.Barcode,T.LOT_NO) T1 ON (A.Barcode=T1.Barcode)
WHERE A.Barcode<>'' 展开
2个回答
展开全部
sql server 和access是不一样的~!
access只能支持基本的T-sql语句,不是完全支持的~~!
你可以去看看assess的资料~!
access只能支持基本的T-sql语句,不是完全支持的~~!
你可以去看看assess的资料~!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询