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/[EMAIL PROTECTED]

Reply via email to