Solved

MySql explode cell value

Posted on 2009-04-09
3
1,142 Views
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.

thanks,
walter
0
Comment
Question by:wal_toor
  • 2
3 Comments
 
LVL 5

Expert Comment

by:cmaohio
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.
0
 
LVL 5

Accepted Solution

by:
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()

http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_substring-index
0
 
LVL 8

Author Closing Comment

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

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This article discusses how to create an extensible mechanism for linked drop downs.
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…

758 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

20 Experts available now in Live!

Get 1:1 Help Now