本帖最后由 ivanl 于 2012-11-11 11:11:59 编辑

解决方案 »

  1.   

    Access里面的子查询结果集是用[]中括号的吗?  我不清楚哈SELECT a.*, b.barcode AS barcode2, b.quan2
    FROM (SELECT a.sysrowid, a.productname, a.barcode, a.quan
     FROM data_inventory 
     WHERE location='店面') AS a 
     INNER JOIN (select barcode,sum(quan) as quan2 
     from data_stocktaking   
     group by barcode) AS b ON (a.barcode=b.barcode) AND (a.quan<>b.quan2)
    你看这样能不能执行?
      

  2.   

    没加 where location='店面' 之前,运行结果是这样的。但是这个 where location='店面'加在哪里才正确呢,试了一个上午都提示有误
      

  3.   

    select a.* from (SELECT a.sysrowid, a.productname, a.barcode, a.quan, b.barcode AS barcode2, b.quan2
    FROM data_inventory AS a INNER JOIN [select barcode,sum(quan) as quan2 from data_stocktaking   group by barcode]. AS b ON (a.barcode=b.barcode) AND (a.quan<>b.quan2)
    ) a   where location='店面'
      

  4.   

    location是 C#关键字,用[location]='店面'