Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help needed with RegEx in MySQL

Status
Not open for further replies.

mcclade

Programmer
Feb 2, 2003
1
GB
I'm trying to use a RegEx in a MySQL query and need to include a value from a coloumn in the RegEx. I'm trying to do something like this:

.... WHERE classes.regNos RLIKE "((^students.regNo,)|(,students.regNo,)|(,students.regNo$))"

where I'd like to search for the value of students.regNo within classes.regNos which is a comma seperated list of integers. MySQL doesn't seem to be resolving "students.regNo" to it's value, when I try the same query with the numbers hard coded it works fine.

Thanks for taking a look at this,

McClade
 
<quote>
within classes.regNos which is a comma seperated list of integers.
</quote>

You shouldn't store values like that. Change the design and store each value as a separate record. If so, you can use an ordinary join which will be easier and much more efficient.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top