mysql split?
| From: | Andrew McCombe | Date: | Fri, 27 Jun 2003 16:05:33 +0000 |
| Subject: | mysql split? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-153159@lists.php.net to get a copy of this message | ||
Hi
I have a field in mysql that has paths to files such as:
project/entertainment/andrew/job/1.jpg
project/corporate/roberts/job/1.jpg
project/corporate/andrew/job/1.jpg
project/identity/john/job/1.jpg
The first level is always 'projects'. What I want to do is get the unique
name for the 3rd level for all entertainment, corporate and identity, so
from the data above I would get returned:
andrew
john
roberts
What's the best way to acheive this? I remember seeing something where you
can split a field in the mysql into parts (ie, split at /)? or would a
regex be better ('WHERE REGEX "^projects/corporate|entertainment|identity/'
(this doesnt work))? Hope someone can help.
Regards
Andrew McCombe
Interactive Web Solutions (Stafford)
Tel: 01785 279921
----------------------------------------------------------------------------
-------------------------
The contents of this e-mail and any attachments are confidential and may
be legally privileged. If you have received this e-mail and you are not
a named addressee, please inform us as soon as possible on
+44 (0) 1785 279920 and then delete the e-mail from your system. If you are
not a named addressee you must not copy, use, disclose, distribute,
print or rely on this e-mail. Any views expressed in this e-mail or any
attachments may not necessarily reflect those of Interactive Web Solutions'
management.
Although we routinely screen for viruses, addressees should scan this
e-mail and any attachments for viruses. Interactive Web Solutions makes no
representation or
warranty as to the absence of viruses in this e-mail or any attachments.
Please note that for the protection of our business, we may monitor and
read e-mails sent to and from our server(s).