超市                   卖场                        总计
日期 客数 销售收入 客单价    客数 销售收入 客单价    客数 销售收入 客单价
一些有关数据提供给大家,多谢了。
查询超市的数据sql语句如下:splsyjid 是“收银机编号”
select spldate "日期",sum(splxsbs1) "客数",sum(splxssr ) "销售收入",round(sum(splxssr )/sum(splxsbs1),2) "平均客单价" from saleposlist where splsyjid between 9101 and 9130 and  trunc(spldate)=to_date‘20061205’,'yyyymmdd') group by spldate查询卖场的数据sql语句如下:
select spldate "日期",sum(splxsbs1) "客数",sum(splxssr ) "销售收入",round(sum(splxssr )/sum(splxsbs1),2) "平均客单价" from saleposlist where splsyjid between 8131 and 8152 and trunc(spldate)=to_date(‘20061205’,'yyyymmdd') group by spldate查询总计的数据sql语句如下:
select spldate "日期",sum(splxsbs1) "客数",sum(splxssr ) "销售收入",round(sum(splxssr )/sum(splxsbs1),2) "平均客单价" from saleposlist where  trunc(spldate)=to_date((‘20061205’,'yyyymmdd') group by spldate

解决方案 »

  1.   

    用QReport就可以做,你看看帮助
      

  2.   

    select spldate "日期",
    sum(case when splsyjid between 9101 and 9130 then splxsbs1 else 0 end ) "超市客数",
    sum(case when splsyjid between 9101 and 9130 then splxssr else 0 end ) "超市销售收入",
    sum(case when splsyjid between 9101 and 9130 then splxsbs1 else 0 end )/
    sum(case when splsyjid between 9101 and 9130 then splxssr else 0 end ) "超市总平均客单价",
    sum(case when splsyjid between 8132 and 8152 then splxsbs1 else 0 end ) "超市客数",
    sum(case when splsyjid between 8132 and 8152 then splxssr else 0 end ) "超市销售收入",
    sum(case when splsyjid between 8132 and 8152 then splxsbs1 else 0 end )/
    sum(case when splsyjid between 8132 and 8152 then splxssr else 0 end ) "超市总平均客单价",
    sum(splxsbs1) "总客数",
    sum(splxssr ) "总销售收入",
    round(sum(splxssr )/sum(splxsbs1),2) "总平均客单价" 
    from saleposlist 
    where  trunc(spldate)=to_date((‘20061205’,'yyyymmdd') group by spldate