输入banner图图片脚本导航/分类

mysql 同样内容的字段合并为一条的方法

 c.category_name, count(*AS task_num, sum( t.amount AS amount_num
FROM cs_witkey_tasks AS t
INNER JOIN cs_witkey_category AS c ON t.category_id = c.cid
GROUP BY c.category_name DESC

应该用group by而不是order by。

技术分享

从两个表中内联取出的数据。当中category_name字段有同样内容。想将具有同样内容的字段进行合并,将amount字段进行加法运算。变成下表中的内容

技术分享

SELECT c.category_name, count(*AS task_num, sum( t.amount AS amount_num
FROM cs_witkey_tasks AS t
INNER JOIN cs_witkey_category AS c ON t.category_id = c.cid
GROUP BY c.category_name DESC

应该用group by而不是order by。

mysql 同样内容的字段合并为一条的方法

标签:order   count   http   sof   esc   rgb   padding   target   内容