473,407 Members | 2,314 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Select match from a stored delimitated string?

Hi :)

I'm not even sure if I'm naming the question correctly. I hope I can
ask/explain it clearly enough to get a hint ;)

Essentially...

1) I have a table of portfolio 'pieces', each row of which has a unique ID

2) I have a table of 'projects', which are comprised of a number of
'pieces'. There is a column in this projects table called 'pieces', which
contains a delimitated string of all the 'pieces' related to that 'project',
in the format of '1||2||3||5||12||16||17||24||25'

3) When viewing a data sheet of a single row in the table 'pieces', I'd like
to be able to include a reference to any 'projects' that the said piece may
be a member of.

I've tried a few things like

$ID = '1';

SELECT * from projects WHERE pieces LIKE '$ID%'
- which will find anything that starts with $ID, such as
1||3||4

SELECT * from projects WHERE pieces LIKE '%$ID%'
- which will find anything that contains $ID, such as
1||3||4
5||1||72||8
3||5||21||9
3||5||17||9

What I can't figure out how to do is to select this
3||5||1||9

Without selecting something like
3||5||21||9 or
3||5||17||9

Is this possible in a single sql statement, or do I have to select all rows
of 'projects' and use php to somehow loop through the results, explode the
delimitated strings, and look for the exact match this way, somehow.

If you haven't noticed, I'm a little bit of a newbie, so please be nice :)

Salut,
verdon
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
0 1302

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Verdon vaillancourt | last post by:
Hi :) I'm not even sure if I'm naming the question correctly. I hope I can ask/explain it clearly enough to get a hint ;) Essentially... 1) I have a table of portfolio 'pieces', each row of...
1
by: Volt | last post by:
is there any way to select and mark part of text in textarea by regular expression? i need to select the first string in textarea whitch is like xxxxx,xxx where x is any character
15
by: grunar | last post by:
After some thought on what I need in a Python ORM (multiple primary keys, complex joins, case statements etc.), and after having built these libraries for other un-named languages, I decided to...
1
by: jamminc | last post by:
Hi All, I am currently developing a module where the user will input multiple items (as many as 20-600) and I am suppose to retrieve it from a sql database all the information and update it with...
1
by: anilcool | last post by:
Hi all, This is probably a simple problem for most of you.. Let me know if you have any pointers for me. I am new to DB2. In my stored procedure I want to select records that match a range of...
3
by: anilcool | last post by:
Hi all, This is probably a simple problem for most of you.. Let me know if you have any pointers for me. I am new to DB2. In my stored procedure I want to select records that match a range of...
2
by: Beowulf | last post by:
If I run this statement in Query Analyzer, it properly returns 1 for my testing table. But if I put the statement into a stored procedure, the stored procedure returns NULL. What am I doing...
8
by: sehiser | last post by:
Hello, I've been reading up on xpath and I am able to access elements with it. I haven't been able to figure one thing out though. How would I use XPath to select an element where the text...
4
by: rn5a | last post by:
A Form has 2 select lists. The 1st one whose size is 5 (meaning 5 options are shown at any given time) allows multiple selection whereas the 2nd one allows only 1 option to be selected at a time. ...
3
by: R. K. Wijayaratne | last post by:
Hello everyone, I have something similar to the below and I am trying to select just the Block 1 markup/text <li><ul>...</ul></liwith the following RegEx @"<li>(.|\n)*<ul>(.|\n)*</ul>\n*</li>",...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.