MySQL Forums
Forum List  »  General

Re: Mysql Query to concat values based on Unique key
Posted by: Ozark Ram
Date: April 29, 2022 12:50PM

Hi Peter,

Appreciate your response!...I am getting an error on this...can you please help here..I am using mysql 5.6

SELECT *,GROUP_CONCAT(CASE WHEN `REASONORINSTRUCTIONCODE`='R' THEN CONCAT( "name-" ,`USERWHOENTEREDTHISLINE`, ",reason-" , RTRIM(`REASONSORSHIPPINGINSTRUCTIONS`) END, ", ")) AS reason,
GROUP_CONCAT(CASE WHEN [`REASONORINSTRUCTIONCODE`] = 'S' THEN CONCAT ("name-", `USERWHOENTEREDTHISLINE` , ",shipping instruction-" , RTRIM(`REASONSORSHIPPINGINSTRUCTIONS`) END, ", ")) AS shipping instruction
from table
GROUP by `PICKUP_NO`

Options: ReplyQuote


Subject
Written By
Posted
Re: Mysql Query to concat values based on Unique key
April 29, 2022 12:50PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.