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
0
votes
1 answer

mysql concat_ws with the result of a custom function prevents like '%str%' from working

So I have the following sql that works: SELECT CONCAT_WS('',`brand`,`pattern`,`product_code`,`size`,`normal_price`,`sale_price`,`text_special`,`load_index`,`speed_index`,`id`) `all_columns` FROM baz_tyres HAVING (`all_columns` LIKE '%con%') …
0
votes
3 answers

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

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…
mtjmohr
  • 99
  • 9
0
votes
0 answers

Concat with conditional inner concat

I am selecting with concat from a table with Name and Notes fields. I am putting the notes in open and close parentheses. In the cases where the Notes field is NULL I don't want any () as the first Select does: Select concat(Name,(concat('…
user3649739
  • 1,829
  • 2
  • 18
  • 28
0
votes
1 answer

ERROR: unknown key name 'CONCAT_WS' in sphinx query

I am new in sphinx and mysql and trying to execute simple query as shown below sql_query = \ (SELECT users.id AS uid, \ CONCAT_WS(' ', users.fname, users.lname, users.email) AS data \ …
VVB
  • 7,363
  • 7
  • 49
  • 83
0
votes
1 answer

Concatenate the result of two concatenations in mySQL

I have this mySQL query: SELECT CONCAT_WS('=>',column_1,column_2,column_3) AS column_union FROM table In which the result is the combination of these 3 columns with => as delimiter. Is it possible to concatenate in the same query the result of…
UgoL
  • 839
  • 2
  • 13
  • 37
0
votes
1 answer

Is it possible to use CONCAT_WS add separator only if value not empty

Let say I have this table id a b 1 data 1234 2 data I want to concat with separator (but) if no data, don't add the separator. If I do UPDATE `table` SET `b` = CONCAT_WS(',',`b`,'newData') WHERE `id` = '1' I get the expected…
user2986055
0
votes
3 answers

CONCAT_WS for Rails?

No matter what language I'm using I always need to display a list of strings separated by some delimiter. Let's say, I have a collection of products and need to display its names separated by ', '. So I have a collection of Products, where each one…
empz
  • 11,509
  • 16
  • 65
  • 106
0
votes
1 answer

Concat_ws not working in insert statement in hive

Using hive, I'm trying to concatenate columns from one table and insert them in another table using the query insert into table temp_error select * from (Select…
0
votes
1 answer

MySQL Nested and Concat Two Columns?

I have the following tables: 1) tbl_entries: +----------+-------------+-------------------+ | entry_id | entry_title | entry_category_id | +----------+-------------+-------------------+ | 10 | Entry 1 | 3 | | 20 |…
Ramil
  • 91
  • 1
  • 2
  • 10
0
votes
1 answer

Mysql Inner join with concat_ws

I have 2 table. first table | idgroup | namegroup second table | idrequest | col1 | col2 | N1 | N2 | date_extract | I want to join the tables with concat_ws SELECT tb1.*,tb2.*, CONCAT_WS("_",tb2.N1, tb2.N2) AS GR, FROM …
lbottoni
  • 962
  • 2
  • 14
  • 26
0
votes
2 answers

MySQL CONCAT_WS three columns, echo result in foreach loop after explode()

I have this as result from MySQL (stored as $result) +-------------------------------------------------------------------------+ | CONCAT_WS('::', p.isMobile, p.contact_phone_id, p.contact_phone_number)…
David
  • 1,171
  • 8
  • 26
  • 48
0
votes
2 answers

MySQL special character concat_ws

I want the following Character » to show when i do a query but I keep getting the following » Here is my query: SELECT CONCAT_WS(' » ',t2.`description`,t1.`description`) AS pages_structure My Database is set to utf8_general_ci
neoszion
  • 249
  • 2
  • 11
0
votes
1 answer

New query within MySql query based on an initial query result

I'm trying to get the contact info from one table ("SP_Cont") and then, based on the county code (CID), get the actual county name ("CTitle") from the "Counties" table. SELECT CONCAT_WS(', ',NULLIF(SP_Cont.Address1, ''),NULLIF(SP_Cont.Address2,…
WOWDesign
  • 56
  • 9
0
votes
2 answers

How to remove the seperator if all values are NULL in MySQL CONCAT_WS?

I am trying to use CONCAT_WS to generate a subject line. However, I want to ignore the seperator if a value is null. Please look at this query SELECT CONCAT_WS(" ", CASE WHEN total_attempts > 0 THEN CONCAT( call_code_title , " - ", total_attempts,…
Jaylen
  • 39,043
  • 40
  • 128
  • 221
0
votes
2 answers

How to limit recordset to dates in the past

Second try on this, I just don't get it. I want to remove graduated students whose grad dates are passed vs $today so I want to limit the recordset to only those whose dates in the db are in the past. My table stores gradMonth and gradYear as…
AllThisOnAnACER
  • 331
  • 1
  • 4
  • 18