This is a lookup table and the data is already there in the comma separated
format. I can't change it.
I'm thinking I need to do some sort of SELECT IN and then create a temporary
table.
Can anyone help me?
"Captain Paralytic" <paul_lautman@yahoo.com> wrote in message
news:1181830481.681955.25380@e9g2000prf.googlegrou ps.com...
> On 14 Jun, 15:03, "John Rappold" <jrapp...@jscoca-k12.org> wrote:
>> I have a table with the following fields:
>> tableid (int)
>> userid (varchar)
>> lvalues (varchar)
>>
>> the lvalues column contains comma separted values. e.g. 12, 5, 32
>> each individual values matches a field in another table.
>>
>> How do I write a SQL query that parses the comma separated data? For
>> example:
>> WHERE user id=30 so that the results look like:
>>
>> 30 | 12
>> 30 | 5
>> 30 |32
>>
>> TIA
>
> You don't you build a table structure where each value has its own
> record in another table.
>
> From:
> http://dev.mysql.com/tech-resources/...alization.html
> "The first normal form (or 1NF) requires that the values in each
> column of a table are atomic. By atomic we mean that there are no sets
> of values within a column."
>