SQL 與 Access 之間的差異

Access對於SQL的語法較為嚴謹,Num1 && Amt9 兩個欄位型態為數值,請注意以下差別
--使用Access Num1 & Amt9 兩個欄位型態為數值
select [name],dept,a.* 
from GDEPTF d 
right join 
(
 select left(dept,2) as SQ1, sum(num1) as N1
 from GPRSNF where yy='097' and (num1<>0 or amt9<>0)
 group by left(dept,2)
) a on a.SQ1=left(d.dept,2) 
where right(d.dept,3)='000'
--使用SQL Server 型態方式寫成字串一樣可以執行
select [name],dept,a.* 
from GDEPTF d 
right join 
(
 select left(dept,2) as SQ1, sum(num1) as N1
 from GPRSNF where yy='097' and (num1<>'0' or amt9<>'0')
 group by left(dept,2)
) a on SQ1=left(d.dept,2) and right(dept,3)='000'

留言