Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1168
  • Last Modified:

MySql explode cell value

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
wal_toor
Asked:
wal_toor
  • 2
1 Solution
 
cmaohioSenior Systems ManagerCommented:
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
 
cmaohioSenior Systems ManagerCommented:
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
 
wal_toorAuthor Commented:
Ahh substring_index() did the trick for me. Thankz
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now