将MS访问查询 - 多个条件 - 转换为SQL Server

时间:2015-07-29 01:55:45

标签: sql ms-access

有人可以帮助我将此访问查询转换为SQL。 它在Access中完美运行。

已经摆弄了足够长的时间:

SELECT cr2.filename, cr2.branch, cr2.typeA, cr2.typeB, cr2.total, 
[typeA]/1.2 AS netA, [typeB]/1.2 AS netB, cr2.receipt, cr2.qty, 
cr2.orderid, cr2.method, cr2.date, ([netA]+[netB])*0.2 AS Vat, 
([Vat]+[netA]+[netB])-[total] AS Diff
FROM cr2
WHERE (((cr2.branch)="SW1") 
AND ((cr2.method)="Visa" OR (cr2.method)="MCard") 
AND ((cr2.date) Between #4/1/2015# And #4/30/2015#)) 
OR (((cr2.branch)="SW1") 
AND ((cr2.receipt)="Y") 
AND ((cr2.method)="Coupon") 
AND ((cr2.date) Between #4/1/2015# And #4/30/2015#)) 
OR (((cr2.branch)="SW1") 
AND ((cr2.qty)<=5) 
AND ((cr2.method)="Coupon") 
AND ((cr2.date) Between #4/1/2015# And #4/30/2015#))
ORDER BY cr2.date;

此外,是否可以拥有GROUP ON分支?

0 个答案:

没有答案