Jump to content

Concat results?


Azu

Recommended Posts

Gives me an error about there being more then 1 result from the query or something.

 

I just want to take all of the rows in all of the columns in the table and concat them into a single result, separated by commas. (well not ALL the columns, but a lot of them)

Link to comment
Share on other sites

I have like 5 rows.. let's call them row1 row2 row3 row4 row5

 

They are all pretty much the same but have different numbers in them

 

I want to take all of them from this table and put them into 1 result, so that I can use them as a subquery, and see if a certain number is in them.

Link to comment
Share on other sites

I'm not sure how to approach this, at least not in a proper and efficient sense. How about something like this?

 

SELECT field FROM table WHERE field IN (

  SELECT DISTINCT foo1 AS pool FROM bar

  UNION

  SELECT DISTINCT foo2 AS pool FROM bar

  UNION

  SELECT DISTINCT foo3 AS pool FROM bar

)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.