concat-ws

Create an immutable clone of concat_ws

会有一股神秘感。 提交于 2020-03-04 04:55:48
问题 This blog post shows an example of how to create a immutable_concat function in Pg: CREATE OR REPLACE FUNCTION immutable_concat(VARIADIC "any") RETURNS text AS 'text_concat' LANGUAGE internal IMMUTABLE I'd like to do the same with concat_ws and the corresponding text_concat_ws does exist, however, the following just crashes the process: CREATE OR REPLACE FUNCTION immutable_concat_ws(VARIADIC "any") RETURNS text AS 'text_concat_ws' LANGUAGE internal IMMUTABLE Update: The siguature of immutable

Multiple Table Joins with Group_Concat where some records don't exist in all tables

不问归期 提交于 2019-12-24 09:55:02
问题 I am trying to do a fairly complex (for me) query that will grab a Description field from a Main Table and then append it with titles and values from related Look-Up-Tables. Not all records have records in the Look-up tables. I'll pose further questions as subsequent questions as I go along, but to start my issue is that only those records with values in all the tables show up. http://sqlfiddle.com/#!9/09047/13 (null) This is Record 2 Text Color : Red Fruit : Apple (null) If I use Concat_WS I

MySQL query: How to properly identify and retranslate comma-separated result values to the original notions using CONCAT_WS and COALESCE

半世苍凉 提交于 2019-12-23 05:38:14
问题 there are many discussions about string-based results being saved in a comma-separated fashion within a MySQL database table. I do not want to extend this here with my own philosophical comments, I just want to start by saying that this issue is well known to me, but not right the topic now. The topic is that I have such a situation to evaluate. The data are saved as string-based cyphers. Each of these cyphers denotes a medical complication after a specific type of surgery has been performed.

How to GROUP_CONCAT where there are null values in MYSQL?

送分小仙女□ 提交于 2019-12-11 15:08:33
问题 I have a long query that returns multiple values for a primary key (from a LEFT join). For example : (only showing two fields, but there about 10 fields) LotID Size 1 A 1 B 1 C 2 null 3 B 4 A 4 B When I use GROUP_CONACT, it returns as follows : LotID Size 1 A,B,C 3 B 4 A,B But what I actually want is : LotID Size 1 A,B,C 2 null 3 B 4 A,B I tried using GROUP_CONCAT(CONCAT_WS(',', IFNULL(Size,''))) AS Sizes, It returns : LotID Sizes 1 A,B,C,,, 3 B,, 4 A,B,, It does not return LotID=2, also