Solved

MySql explode cell value

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

786 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