select field from table union select sum(field) from table
dearmyfriend(Dearmyfriend) 是否可以更详细一些呢?
SELECT *, b.sum1 AS Expr1 FROM tsg_book CROSS JOIN (SELECT SUM(Book_dbs) AS sum1 FROM tsg_book) b 看这个,行不行?
select field1,sum(field2) from table1 where …… order by field1
已经够清楚了, 如:有表tbl其中有字段a,b,c 显示: a b c a b c a1 b1 50 a1 b1 50 a2 b2 3 a2 b2 3 a3 b3 20 a3 b3 20 合计73 select a,b,c from tbl union select '''' as a,''合计'' as b,sum(c) as c from tbl
select sum(某个字段名) from table
union
select sum(field) from table
是否可以更详细一些呢?
FROM tsg_book CROSS JOIN
(SELECT SUM(Book_dbs) AS sum1
FROM tsg_book) b
看这个,行不行?
where ……
order by field1
如:有表tbl其中有字段a,b,c 显示:
a b c a b c
a1 b1 50 a1 b1 50
a2 b2 3 a2 b2 3
a3 b3 20 a3 b3 20
合计73
select a,b,c from tbl
union
select '''' as a,''合计'' as b,sum(c) as c from tbl