当前位置: 代码迷 >> Sql Server >> 关于Access中建立查询sql的有关问题
  详细解决方案

关于Access中建立查询sql的有关问题

热度:21   发布时间:2016-04-27 20:04:44.0
关于Access中建立查询sql的问题
现在我写了一段sql语句,我要在Access中建立这个查询,但是我简单的把它copy就报错,那位大虾能够知道下小弟,是不是在Access中有些sql的语法是不能用的呢?
select   c.instance,   c.usercallNo,   c.description,   c.status,   c.BranchID,   c.customerNo,   c.LOB,   c.BusUnit,   c.Market,   c.dept,
cy.yr,   cy.B_Jan,   cy.b_feb,   cy.b_mar,   cy.B_apr,   cy.b_may,   cy.b_jun,   cy.b_jul,   cy.b_aug,   cy.b_Sep,   cy.b_Oct,   cy.B_Nov,   cy.B_Dec,   cy.b_total,
cy.c_Jan,   cy.c_feb,   cy.c_mar,   cy.c_apr,   cy.c_may,   cy.c_jun,   cy.c_jul,   cy.c_aug,   cy.c_Sep,   cy.c_Oct,   cy.c_Nov,   cy.c_Dec,   cy.c_total,
cy.b_jobtodate,   cy.b_yeartodate,   cy.c_jobtodate,   cy.c_yeartodate,cm.bc01   as   MTDBillings,   (cm.cc01+cm.cc06)   as   MTDCost
from   tblcalls   c  
--Join   callyears
join   tblcallyears   cy   on   c.callNo=cy.callNo
--Join   MTD   Billing   and   MTD   Cost
join   tblcallmonths   cm   on   cm.callNo=c.callNo   and   cm.Month= '2007-07-01   00:00:00.000 '
where   c.instance= '657 '   and   c.branchID= '3 '  
order   by   c.dept,   c.usercallno,   cy.yr

------解决方案--------------------
報的錯誤是什麼?寫詳細點

或者
select c.instance, c.usercallNo, c.description, c.status, c.BranchID, c.customerNo, c.LOB, c.BusUnit, c.Market, c.dept,
cy.yr, cy.B_Jan, cy.b_feb, cy.b_mar, cy.B_apr, cy.b_may, cy.b_jun, cy.b_jul, cy.b_aug, cy.b_Sep, cy.b_Oct, cy.B_Nov, cy.B_Dec, cy.b_total,
cy.c_Jan, cy.c_feb, cy.c_mar, cy.c_apr, cy.c_may, cy.c_jun, cy.c_jul, cy.c_aug, cy.c_Sep, cy.c_Oct, cy.c_Nov, cy.c_Dec, cy.c_total,
cy.b_jobtodate, cy.b_yeartodate, cy.c_jobtodate, cy.c_yeartodate,cm.bc01 as MTDBillings, (cm.cc01+cm.cc06) as MTDCost
from (tblcalls c
inner join tblcallyears cy on c.callNo=cy.callNo)
inner join tblcallmonths cm on cm.callNo=c.callNo
where c.instance= '657 ' and c.branchID= '3 ' and cm.Month=#2007-07-01#
order by c.dept, c.usercallno, cy.yr

  相关解决方案