Jump to content

Is it possible to do this in MySQL?


alanlai

Recommended Posts

I know that it is possible to do this using PHP, except that it would require making multiple queries instead of just one.

 

How do I do this using one MySQL query?

 

[pseudocode]select(select column1,column3 from table2 where column2 in explode(table1.columnA,',')),columnB,columnD,columnE,columnF,etc from table1 where BLAH BLAH BLAH(irrelevant)[/pseudocode]

 

I have encountered two problems trying to do this.

 

1. I cannot find an explode function in MySQL. All I have been able to find from Google are suggestions to have temporary tables be created, populated, and queries extensively. This would defeat the purpose of trying to achieve good performance, so I am trying to find a better way.

 

2. I don't the proper way to handle multiple results from subqueries. I want them to be concatenated or something so that there will only be one result, but I don't know how to do this efficiently.

 

Please help!

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.