Concatenate Row Results Sql Php

You simply need to take after a couple steps and you will be guided in each progression of the procedure. World of tanks blitz. So disregard searching for WoT codes cause that is so much tedious and some of the time, you won’t have the capacity to locate a working one.

I would like to concatenate one column from the returned results from a query. For example, if the query below returns: 47796 I would like @vchResultIDs = '4786052, 4786796' Is this possible? Also, is there another function or combination of functions that would shorten this code. Yes, look at the XML concatenation. See explanations of.

I am writing a sql code for a project which contains a nested select query.This is the part of the query I actually want to get.

Sql Concatenate Multiple Results

'AND s.thirdparty in (2,3,5)';

I can get values 3 and 5 easily with following code.

'AND s.thirdparty in (select hid from tblname where col1='xx')'

which returns,

'AND s.thirdparty in (3,5)'

but I cannot get value 2 that way. So can I just add it to the result of the nested query so I have the full query I need?

Sql
amsandunamsandun
Sql concatenate rows into one

1 Answer

Since 2 is a known constant use UNION ALL in the subquery:

or:

forpasforpas
31.4k5 gold badges10 silver badges30 bronze badges
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.

Not the answer you're looking for? Browse other questions tagged mysqlsql or ask your own question.

Comments are closed.