如何更改从 ROLLUP 创建的最后一行的文本

How to change text on the last row created from ROLLUP

提问人:kompus 提问时间:11/10/2023 更新时间:11/10/2023 访问量:56

问:

我创建了这个SQL查询:

SELECT
    orders.order_id AS "Nr. zamówienia",
    orders.order_date AS "Data zamówienia",
    products.name AS "Nazwa produtku", 
    products.price AS "Cena produtku", 
    orders.count AS "Ilość", 
    clients.client_id AS "Numer klienta",
    clients.first_name AS "Imię", 
    clients.last_name AS "Nazwisko",
    SUM(orders.count * products.price) AS "Cena Łączna"
FROM orders
INNER JOIN clients ON orders.client_id = clients.client_id
INNER JOIN products ON orders.product_id = products.product_id
WHERE orders.client_id = 215234
GROUP BY orders.order_id WITH ROLLUP

并得到这个结果:resuult of query

是否可以将最后一行更改为仅在“Nazwisko”列中显示“Sum:”,而不显示加倍的最后一行?

SQL MySQL MariaDB 汇总

评论

0赞 yotheguitou 11/10/2023
stackoverflow.com/questions/6822666/......
0赞 kompus 11/10/2023
好的,但并非所有列都是空的
0赞 jarlh 11/10/2023
联接和分组依据可能有点棘手。有时您需要在加入之前进行分组。
0赞 Paul Spiegel 11/18/2023
请不要发布文字/数据的图片。以文本表格的形式发布当前和预期结果。还要告诉我们是否所有 -columns 都是其表中的主键。理想情况下,使用示例数据创建摆弄。_id

答: 暂无答案