我有表订单
我想
select (OrderName) Values Concatenated by (dash) While last OrderName Concatenated by (Dot)
我使用了以下内容:SELECT CONCAT(OrderName , ' - ') AS 'Name' FROM Orders
示例:
order1 - order2 - order3 .
答案 0 :(得分:0)
只需使用GROUP_CONCAT
即可 SELECT CONCAT ( SUBSTRING(`Name`, 1, CHAR_LENGTH(`Name`) - 2),
' . ') as `Name`
FROM (
SELECT GROUP_CONCAT(OrderName, ' - ') AS `Name`
FROM Orders
) T