MySQL Forums
Forum List  »  Newbie

Re: SQL for CONCAT and remove character from certain columns
Posted by: manik safo
Date: March 14, 2018 10:08AM

Thanks a lot! that really helped :)

my query looks like this now;

SELECT doc_no , doc_type,
CASE
WHEN doc_type = "B" THEN LEFT(doc_no, LENGTH(doc_no)-4)
WHEN doc_type = "A" THEN LEFT(doc_no, LENGTH(doc_no))
WHEN doc_type = "A" || "B" THEN CONCAT("BD/",doc_no)

END AS doc_no
FROM client_document

However the last WHEN statement doesn't work, it should make all doc_no start with BD/

Options: ReplyQuote


Subject
Written By
Posted
Re: SQL for CONCAT and remove character from certain columns
March 14, 2018 10:08AM


Sorry, you can't reply to this topic. It has been closed.

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.