MySql explode cell value

Posted on 2009-04-09
Last Modified: 2013-12-12
Is there a way to explode a cell value within a mysql statement

for example

("SELECT * FROM image_files WHERE details = 'Explode("-",details')Return array[2]'")

Hope that kinda makes sense. I want to explode the value in column details at the "-" and get the third value sent in the array as it would if using the php explode feature.

Question by:wal_toor
  • 2

Expert Comment

ID: 24111017
MySQL doesn't have an explode function so you cannot do this. You will have to pull the data out of the database with one query, get the value through exploding the data, then do another query.

Accepted Solution

cmaohio earned 500 total points
ID: 24111032
the only other thing I can think of is through an elaborate use of the substring() or even substring_index()

Author Closing Comment

ID: 31568709
Ahh substring_index() did the trick for me. Thankz

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Unable to save view in SSMS 21 59
How can I upload multiple images from a HTML form? 2 18
Make query more efficient 1 17
My Query is not giving correct result. Please help 5 30
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now