Multiple values stored in single field with relationship to table.

i have inherited a mysql database and the developers have used muliple values in a field seperated with an @ symbol.
this field contains reference numbers which relate to another table in the database.

ok so table 1 has this

propid       Charac
1             @41@869@48@874@877@878@879@881@885@870@898@901@903@
2             @41@869@48@874@877@878@879@881@885@870@898@901@903@

Table 2 has this
keyid           descr
41              desc1
42              desc2
869            desc3
48              desc4

i want to run a query so i get this

propid           Descr
1                   desc1
1                   desc3
1                   desc4
2                   desc1
2                   desc3

is this possible??
Thanks all!!

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

It would have been for more easier when he/she would have used comma's rather than @'s. Is it possible for you to change this easily, or is that not going to work for the rest of the application?

Craigster2006Author Commented:
unfortunately its not possible to change the @ symbol - this is a db for another app.

select * from table1 join table2 on table1.charac like concat('%@',table2.keyid,'@%)

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Muhammad WasifCommented:
try this one

select table1.propid, table2.descr from table2
table2.keyid IN (REPLACE( SUBSTRING(table1.Charac,2), '@', ','))
$query1="SELECT * from table1 where 1";
while ($row=mysql_fetch_array($result1)){
foreach ($a as $value){
if ($a!=""){
$query2="SELECT * from table2 where keyid='$value'";
$result2=mysql_query($query2) or die(mysql_error());
print "$row[propid] $row2[descr]<br>";

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Craigster2006Author Commented:
Thanks Perfect man!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.