![]() |
#2
cnfarer2012-08-12 09:34
|
A表中有四列,记录号、商品名称、金额、登记时间
selsct * from A union all select null,'合计',sum(金额),null from A order by case when 登记时间 is null then 1 else 0 end,登记时间
分析没问题,一运行就报错
如果语句中包含union运算符,那么 order by 子句中的项必须出现在选择列表中。