Questions tagged [concat-ws]

This function returns a string resulting from the concatenation, or joining, of two or more string values in an end-to-end manner. It separates those concatenated string values with the delimiter specified in the first function argument. (CONCAT_WS indicates concatenate with separator.)

This function returns a string resulting from the concatenation, or joining, of two or more string values in an end-to-end manner. It separates those concatenated string values with the delimiter specified in the first function argument. (CONCAT_WS indicates concatenate with separator.)

Syntax

CONCAT_WS ( separator, argument1, argument2 [, argumentN]... )
52 questions
8
votes
2 answers

Create an immutable clone of concat_ws

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…
svoop
  • 3,318
  • 1
  • 23
  • 41
3
votes
2 answers

Generate new string variable by concatenating two integer variables with MySQL

I apologize for the silliness of the question but am a complete neophyte with MySQL and am having trouble even reading the documentation for this. I have a table with two columns "homeid" and "indid", which are both integer data fields. I want to…
SMM
  • 193
  • 1
  • 3
  • 12
3
votes
2 answers

How do I stop a comma being added using CONCAT_WS if column is empty

SELECT CONCAT_WS(',', Col1, Col2, Col3 ) AS combined FROM table_name Currently if I have fields Col1 = 'hello', Col2 = 'Bye', Col2 = 'Goodnight' The above select statement would return hello,Bye,Goodnight which is fine. What if any of the Cols…
2
votes
2 answers

How to use CONCAT_WS with COALESCE?

I have a table users which has fields firstName and lastName. Both of them can be NULL. I would like to select the full name, one of them, or if both are not set then default to a string. I tried the following query, but if both of them are NULL the…
Dharman
  • 30,962
  • 25
  • 85
  • 135
2
votes
2 answers

Hibernate concat_ws and null fielnds

Im using CONCAT_WS within hibernate query, to create a giant string and search by all fields using like '%value%' . It works fine, but for some records some fields are null. e.g if actId is null, my whole concat_ws returns null. I don't know why,…
2
votes
1 answer

MySQL CONCAT: Add a comma/separator only when field is NOT NULL

To summarize, I have an update query that will tack on a string of data (e.g. SAVE15) to an existing field. Currently, I anticipate this field to already have some information in it so my values are appending as ", SAVE15" which is a comma and space…
sparecycle
  • 2,038
  • 5
  • 31
  • 58
1
vote
1 answer

mysql - Query with IFNULL and CONCAT_WS returns empty string instead predefined IFNULL parameter in case of NULL

I am working on the complex MySQL query with subquery and JOINs and this is my query: SELECT id, ancient_source_name, ancient_source_name_alt, ancient_source_type, ancient_source_type_id, IFNULL(IF(ancient_source_material =…
Boris J.
  • 113
  • 8
1
vote
0 answers

How to handle RSS in IBKR in TWS?

Hi, this is my first post here, so don't know about any rules here. How to ask, how to tag, etc. I'm a german stock trader, "fighting" with the TWS daily. Have to learn how to handle API stuff in the future, but actually no time to do so. Have still…
1
vote
1 answer

Difference in behavior on CONCAT_WS between systems

So, this is a simple situation but I wanted to understand what's causing this issue. I have the following code (modified for example): SELECT `Transactions`.*, CONCAT_WS(" ", `People`.`first_name`, `People`.`last_name`) AS full_name ... On my local…
Mihail Minkov
  • 2,463
  • 2
  • 24
  • 41
1
vote
0 answers

MySQL - Concat all colums in a string

I need to concat all columns in a string of a row. Something like this can be possible? SELECT CONCAT_WS(';', *) FROM db.table Table: |col1 |col2 |col3 | ------------------------- |val11 |val12 |val13 | |val21 |val22 |val23 …
Riccardo
  • 33
  • 4
1
vote
0 answers

How to optimize the code to choose the lines I want to extract in Hadoop Hue and concat a text from a column?

I'm working with Hadoop on Hue and there is a limitation of 100000 lines that can be downloaded. I would like to choose the lines that I will download in order to download the entire base. Example: line 1 to 100000, 100001 to 200000 ... Issue 1: I'm…
1
vote
2 answers

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

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…
user3649739
  • 1,829
  • 2
  • 18
  • 28
1
vote
1 answer

MySQL: CONCAT_WS function is running on local but not on server

Some days ago I asked a question about my problem and I was advised to use CONCAT_WS function. I am using CONCAT_WS on my local mysql database and it is working perfectly. But it is not working on server(application hosted) and generate the…
Naveed
  • 41,517
  • 32
  • 98
  • 131
1
vote
1 answer

SQL concat_ws syntax error

I tried to run the following concat_ws code but I am getting a syntax error. what is wrong with this sql code? select count(policy_number) from resp_party where c_policy_effective_date = concat_ws('-', policy_effective_date_yyyy, …
DP8
  • 55
  • 1
  • 7
1
vote
1 answer

Boggled... MYSQL + JOIN + PAGINATION

I've spent far too long trying to come up with a good solution to this problem on my own. Haven't found any good answers to help, though I've tried meshing solutions from different answers without luck. Goal: Present a paginated Projects page…
Chris
  • 893
  • 10
  • 23
1
2 3 4