select b.tradecode,b.fullname,b.fullname,b.qty,b.price,sum(b.tsum) from tb_sell_main  a inner join (select billcode,tradecode,fullname,sum(qty),sum(tsum)from tb_sell_detalied )b a.billcode=b.billcode where(biidate between '"+dptStart .Value +"'and '"+dtpEnd +"')

解决方案 »

  1.   

    sql语句有问题。加上一个断点,看输出什么sql,尤其是括号、引号的匹配。
      

  2.   

    是不是少了一个 ON
    select b.tradecode,b.fullname,b.fullname,b.qty,b.price,sum(b.tsum) from tb_sell_main a inner join (select billcode,tradecode,fullname,sum(qty),sum(tsum)from tb_sell_detalied ) b On a.billcode=b.billcode where(biidate between '"+dptStart .Value +"'and '"+dtpEnd +"')
      

  3.   

    第二行...)b on a.billcode=b.billcodeps:新手要在查询分析器里写sql,测试好再说...
      

  4.   

    select b.tradecode,b.fullname,b.fullname,b.qty,b.price,sum( b.tsum ) from tb_sell_main  a inner join (select billcode,tradecode,price, fullname,sum(qty ))as qty,sum(tsum)as tsum from tb_sell_detailed  GROUP BY tradecode, billcode, fullname,price)b on a.billcode=b.billcode where(billdate between '"+dptStart .Value +"'and '"+dtpEnd.value +"') GROUP BY b.tradecode, b.fullname
    消息 102,级别 15,状态 1,第 1 行
    ',' 附近有语法错误。
      

  5.   

    这SQL写的select b.tradecode,b.fullname,b.fullname,b.qty,b.price,sum( b.tsum ) from tb_sell_main a inner join (select billcode,tradecode,price, fullname,sum(qty ))as qty,sum(tsum)as tsum from tb_sell_detailed GROUP BY tradecode, billcode, fullname,price)b on a.billcode=b.billcode where(billdate between '"+dptStart .Value +"'and '"+dtpEnd.value +"') GROUP BY b.tradecode, b.fullname红色标注的格式错误而且 你的什么as 以及表的别名之间好歹加一个空格啊。
      

  6.   

    select b.tradecode,b.fullname,b.fullname,b.qty,b.price,sum( b.tsum ) from tb_sell_main a inner join (select billcode,tradecode,price, fullname,sum(qty ))as qty,sum(tsum)as tsum from tb_sell_detailed GROUP BY tradecode, billcode, fullname,price)b on a.billcode=b.billcode where(billdate between '"+dptStart .Value +"'and '"+dtpEnd.value +"') GROUP BY b.tradecode, b.fullname,b.qty,b.price试试
      

  7.   

    select b.tradecode,b.fullname,b.fullname,b.qty,b.price,sum(b.tsum) from tb_sell_main a inner join (select billcode,tradecode,fullname,sum(qty),sum(tsum)from tb_sell_detalied )b  on a.billcode=b.billcode……