Questions tagged [concat]

In formal language theory and computer programming, string concatenation is the operation of joining two character strings end-to-end

Filter by
Sorted by
Tagged with
1
vote
2answers
28 views

Best Practices for Separating Content from Presentation in SQL

A common and useful paradigm of programming is to separate content and presentation. One system deals with building the result, another system deals with outputting it. You see this with HTML vs CSS. ...
0
votes
0answers
26 views

How to avoid GROUP BY on one field in Oracle SQL

i'm using a query : SELECT t.tID, min(t.CONTEXTTIMESTAMP) contextTime, CONCAT(' ',CONCAT(ac.NAME, CONCAT('=',ac.VALUE))) as idf FROM TABLE1 t INNER JOIN ( select t....
0
votes
1answer
38 views

Concatenation of varchar-converted DATEDIFF and placing a string afterwards - issues?

Everyone, the table relationship diagram for the database is the below one In case the full DDL for the database is requested, I can provide it (although it will probably exceed the character limit ...
0
votes
0answers
4 views

Return only unique values when concatenating fields in MS Access Report

How can I show only unique values when concatenating 2 field in an access report? The code would need to be case insensitive. Let's say that if the values are the same, the first value will be kept. ...
0
votes
1answer
18 views

Concatenate in MS Access - how to omit space and comma if first value is missing?

I am concatenating 2 values in a MS Access Report: "Method" and "Experiment" and they are to be separated by a comma (,). I have figured out how to concatenate succesfully when the second value is ...
-1
votes
1answer
42 views

Concat digits into xxx-xxx form

Example, I get data from eclipse and insert into 'abc' table. so, now how I can get the data from the 'abc' table and concat the digit? Example: I enter 123456 then in SQL need to concat into format ...
0
votes
1answer
19 views

How to concatenate these two statements (RIGHT and LEFT)? I am trying to trim two characters off both the beginning and end of cell

Is it possible to either combine or concatenate the following two statements? RIGHT(wp_postmeta.meta_value, LENGTH(meta_value) -2) LEFT(wp_postmeta.meta_value, LENGTH(meta_value) -2) What I am ...
0
votes
1answer
37 views

Dynamic Pivot Table syntax error

What's wrong with this Dynamic Pivot table query? I'm staring myself blind on this. mysql> SET @sql = NULL; Query OK, 0 rows affected (0.00 sec) mysql> SELECT -> GROUP_CONCAT(DISTINCT ...
0
votes
1answer
149 views

Replace part of a string in MYSQL, when only the substring's starting characters, ending characters & a unique string in the middle is known?

I'm trying to find a way to replace part of a string in a database without knowing the exact substring content other than how it starts, ends and has a specific ID string somewhere in between that. ...
3
votes
3answers
188 views

Why does the concatenation order change with a User-Defined Table Type?

I've encountered what seems to me to be a strange ordering issue when using CONCAT with a User Defined Table Type. I've put the SQL below that allows me to reproduce this: I have the following user ...
-2
votes
1answer
34 views

How to concatenate rows into one comma seperated value when used with case statements

I have a query that has multiple case statements. I am trying to reduce the results to one row per USER_ID that has one of the columns (specialty_id) comma separated because some users have more than ...
6
votes
2answers
590 views

NULL value causes blank row in SELECT results for text concatenation

I have a query for producing some text for creating some VALUES text to put in a .sql file for inserting some rows. I get a blank line in the results: postgres=# SELECT ' (' || obj_id || ', ''' || ...
0
votes
1answer
28 views

How to use query result as REPLACE parameters

i'm trying to: 1- Find a string inside a lot of content 2- Replace that specific part of the string with a new one using REPLACE function like this: REPLACE(column_name, query#1, query#2) Is this ...
0
votes
1answer
18 views

Postgresql Date Function Returning Range In Readable Format

I am wondering if it is possible to use postgresql's date-time , concat and case functions to give one of the following results: June 4th to 11th 2019 (where the 1st and 2nd date are within the same ...
0
votes
0answers
451 views

Sql subquery for nested parent child data

I have two tables , on parent table (categories ) and child table (features).. I have this query select c.* , (select GROUP_CONCAT(f.featuresId , f.featuresTitle ) from ...
0
votes
0answers
26 views

How performant is finding a substring in database?

To route requests on my website, I need to query the database to see if the first part of a URL matches a category for an item. For example: I have a request to /animals/dog/darktheme/. The ...
3
votes
1answer
891 views

Large string concatenation in query

I am trying to concatenates strings in T-SQL like 'This is a test ' + CHAR(13) + CHAR(10) + ' string' When the string is long (I do not know the limit), I get an error: Some part of your SQL ...
0
votes
1answer
238 views

CONCAT_WS causes “Data too long” which works partially?

I've got a simple table with several columns and I'm trying to merge two of them into one. I'm working with MySQL 5.5 and I can reproduce the error one a specific data set by running the following (...
2
votes
2answers
379 views

How can the concatenatation of a text and a NULL value return a non-null result?

Assert 1 The concatenation operator || can concatenate any string type values, returning text. In Postgres, every type has a text representation and can be cast to text. Consequently, quoting the ...
2
votes
2answers
501 views

How to Concat Datetime without Losing Second Precision

What is best way to Concat on datetime column with other fields, without losing/truncate millisecond precision? Example: We have a column in datetime precision. 1988-02-27 00:00:04.000 We are ...
-3
votes
1answer
4k views

Updating a string field by concatenating 2 int columns

I have 2 columns, an int and a tiny int, and I want to update another column, a varchar one, with the value column1 + '-' + column2. Something like this pseudo code: UPDATE COLUMN3 varchar = CONCAT (...
0
votes
1answer
1k views

Concatenate into Field in Update

I am trying to write a Stored Procedure which updates a quantity data column in one of my tables, and then takes a field set for random notes and concatenates the update information. This is what I ...
1
vote
1answer
465 views

SQLite3 doesn't have concat_ws, looking for workaround

I'm trying to concatenate some columns and I would like to use space as my output string delimiter. Basically concat_ws would be a perfect fit, but it doesn't exist for SQLite3. I'm inside a ...
1
vote
2answers
2k views

How to Concatenate DateTime to nvarchar field

I have a table with a nvarchar(32) column and I want to update the value in this column with the first 10 bytes of another field on the table which is defined as nvarchar(32) after the 10 bytes I want ...
1
vote
1answer
120 views

Removal of blank lines

I am creating a SSRS Report to produce some address labels. I have a SELECT statement as follows: SELECT DISTINCT AddressLink.intAddressID, Addresses.txtLabelSalutation, ...
7
votes
2answers
7k views

Conditional string concatenation in PostgreSQL

I have a table parcels which currently contains the columns owner_addr1, owner_addr2, owner_addr3. Sometimes, one or both of the latter two fields is empty. I want to combine them into a single new ...
-1
votes
1answer
4k views

Update a table using values from another table

I have two tables with structure Table1 ------ No | Name | IDNo | HouseNoBlock Table2 ------ IDNo | HouseNo | Block I am trying to update the HouseNoBlock Column of first table with value ...
2
votes
1answer
2k views

MySQL “Out of sort memory” error on a simple GROUP_CONCAT query

I have a (what it seems to me) simple query which fails to run on a simple table, the error is: Out of sort memory, consider increasing server sort buffer size These are the SQL statements which I'...
1
vote
3answers
352 views

Array to string sometimes concatenates fewer values

array_to_string(array_agg(array_to_string(array[ highlights,exceptions,inter_note,inter_status::text ,comp_note,comp_status::text,hard_note,hard_status::text] ,'|#|'::...
1
vote
1answer
5k views

Optimizing query. FOR XML PATH or some alternatives?

Is there any way to optimize the FOR XML PATH statement? Or maybe I should use another approach? Current approach is not acceptable at all. It takes minutes. I know view is a really big union and it ...
0
votes
2answers
67 views

Is there any way to concatenate a value in a column with different strings?

As you can see on the column 'Race Position' I have a set of values corresponding to the participants results. 1 being 1st Position and so on. What I wanted was to be able to concat the values and ...
3
votes
1answer
1k views

How do I build a PostgreSQL ORDER BY expression based on a concatenation of columns?

I'm using Postgres 9.5. I want to write an order by expression for a series of concatenated strings, but I'm not sure if that's possible or how to do it. I have cobbled together the below myproject=...
1
vote
1answer
4k views

Loop inside of query in mysql procedure. Is it possible?

I have the following query: INSERT INTO major (key_1, key_2, ... , key_N) VALUES (v_1_1, v_1_2, v_1_3, ... , c_1_N) (v_2_1, v_2_2, v_2_3, ... , c_2_N) ... (v_K_1, v_K_2, v_K_3, ....
1
vote
2answers
3k views

Query with join and concatenation of one joined table's column

I have the following structure: Table R Table RZ (n-m) Table Z ------- ----------------- --------- R1 R1 | Z1 Z1 | "A" R2 R1 | Z2 Z2 | "B" R3 ...
0
votes
1answer
61 views

Concatenating Multiple Columns in TSQL

I have the following data JoinFlag ReferenceType ReferenceValue A CARRIER Sample####### A LEASE_NUMBER 17438 A LEASE_NUMBER 6054 A ...
0
votes
2answers
135 views

Elegant way for concatenation

I am looking for the most elegant solution to prevent the addition of the last/ final separator ';' after the last row. For example the result should be 'Peter,Paul,Jill' instead of 'Peter,...
0
votes
1answer
6k views

SQL server Like pattern match with CONCAT() always fails

I am facing problem in a simple query script for SQL server. Please help The script is CREATE PROCEDURE [dbo].[Search_By_Author_And_Name] ( @Author_name AS [varchar](50) ) AS BEGIN Select B....
1
vote
4answers
17k views

MySQL 5.7 JSON_MERGE combine with GROUP_CONCAT

we have table with JSON column for example simple: {"a": 1} {"b": 2} run JSON_MERGE query select JSON_MERGE('{"a": 1}','{"b": 2}') result correct: {"a": 1, "b": 2} run the GROUP_CONCAT query ...
2
votes
1answer
86 views

How to migrate a huge application to CONCAT_NULL_YIELDS_NULL ON

Finally, none of our customers are using SQL Server 2005 anymore, so we can drop support for it and start using all those awesome "new" SQL Server 2008 features (indexed views, filtered indexes, query ...
20
votes
2answers
748 views

Why does Concatenation operator estimate fewer rows than its inputs?

In the following query plan snippet, it seems obvious that the row estimate for the Concatenation operator should be ~4.3 billion rows, or the sum of the row estimates for its two inputs. However, an ...
9
votes
3answers
59k views

SQL Row concatenation with XML PATH and STUFF giving aggregate sql error

I am trying to query two tables and get results like the following: Section Names shoes AccountName1, AccountName2, AccountName3 books AccountName1 The tables are: CREATE TABLE dbo....
0
votes
2answers
4k views

Concatenate column values [duplicate]

I have a query that uses a couple joins to get a name from another table. It works okay except that I would like to combine "Examiners Name" instead of having multiple duplicates: ID | Name ...
31
votes
2answers
107k views

'CONCAT' is not a recognized built-in function name

A client reported that they were running on SQL Server 2012, and we delivered some test queries for testing prior to a final delivery, however: 'CONCAT' is not a recognized built-in function name. ...
1
vote
0answers
211 views

Mysql trigger with group_concat

I'm trying to create insert and update triggers with SELECT GROUP_CONCAT request on one of the fields; This select query perfectly works, when I trying it in console, but trigger saves only first ...
4
votes
1answer
6k views

Syntax error with concat in trigger near signal statement

Please help me with syntax for MySQL 5.6. For some reason I get the error: ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version ...
2
votes
2answers
6k views

Concatenate Columns in Stored Procedure [duplicate]

I have a stored procedure which returns a weekly result from input parameters start date and end date. I am getting multiple rows in the result. Requirement: I want to add the results of columns in a ...
20
votes
4answers
51k views

How to exclude NULL values inside CONCAT MySQL?

If I have this - tadd is the Address table: CONCAT(tadd.street_number, ' ', tadd.street_name,', ', tadd.apt_number,', ', tadd.city,', ', tadd....
1
vote
1answer
550 views

convert 1 row as column and concatenate the results to the corresponding column

I have 2 tables table 1 - apps ----------- id | name ----------- 1 | abc ----------- 2 | sdf ----------- 3 | dfg ----------- table 2 - contacts ------------------------ id | cnt_type | ...
1
vote
2answers
1k views

query to concatenate columns if record duplicate

My table has two column that is id and name. I want to do concatenate the columns if the if more than two names are same like: id ...
2
votes
2answers
2k views

Creating a stored procedure and adding date manually to filename

I am new to SQL administration and have been tasked with creating some nightly jobs that send an email with certain details contained within a spreadsheet and so far I have the following: EXEC msdb....