Merge fields with the same mysql content into one method. mysql Fields
The data taken from the two tables inline. The category_name field has the same content. to merge fields with the same content, add the amount field to the following table.
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
Use group by instead of order.
The data taken from the two tables inline. The category_name field has the same content. to merge fields with the same content, add the amount field to the following table.
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
Use group by instead of order.