SQL语句如下:
   strSQL = " select format(sum(实收额),'####0.00') as 总计,format(sum(标准价),'####0.00') as 标准价, format(sum(优惠额),'####0.00') as 优惠额, sum(人数) As 人数 "
    strSQL = strSQL + "From 客户结帐  where 结帐情况='已结' and exists(select format(sum(利润),'##0.00') as 利润, sum(数量) as 数量 from 流水记录 where 流水记录.客次=客户结帐.客次) and " + tempDateSQL显示在MSHFlexGrid中的查询结果只有主查询的四个字段:总计,标准价, 优惠额, 人数
而子查询的两个字段和值:“利润, 数量 ”没有显示出来,如何解决。
我期望的是下面的显示结果:
总计,标准价, 优惠额, 人数,利润, 数量 

解决方案 »

  1.   


    select format(sum(A.实收额),'####0.00') as 总计,format(sum(A.标准价),'####0.00') as 标准价, format(sum(A.优惠额),'####0.00') as 优惠额, sum(A.人数) As 人数,format(sum(B.利润),'##0.00') as 利润, sum(B.数量) as 数量 "
        strSQL = strSQL + "From 客户结帐 A,流水记录 B  where 结帐情况='已结' and A.客次=B.客次 and exists(select 客次 from 流水记录 where 流水记录.客次=客户结帐.客次) and " + tempDateSQL + " group by 客次"
    这是sql语句问题,你还是把这两张表结构列出来,给你写sql语句吧。