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
https://forums.phpfreaks.com/topic/102981-is-it-possible-to-do-this-in-mysql/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.