Trying to set up a category WAP solution for piCal.
I have a field that stores category IDs in varchar. If the entry belongs to more than 1 category, it will contain multiple category IDs in the same field, seperated by a comma.
eg. DATA
UID | CATEGORIES
----------------------------
record1 | 00001 | - record1 belongs to 1 cat
----------------------------
----------------------------
record2 | 00001,00002 | - record2 belongs to 2 cats
----------------------------
-----------------------------
record3 | 00001,00002,00003 | - record3 belongs to 3 cats
----------------------------
I need an SQL Query which will return ALL records with any given CATEGORY ID.
eg.
$CATID = 00002
Would return:
record2 | record3
$CATID = 00003
Would return:
record1 | record2 | record3
I don't have experience with delimited string selection/comparison and have spent about 2 hours reading on the MySQL dev site so far...ugh...
If you can fill in the ???, you are my hero:
$result = mysql_query("SELECT id, summary, description, start FROM $prefix"._pical_event." WHERE admission=1 AND $CATID ???????????????????? ORDER BY start ASC")
Thanks for any help and I'll be happy to share the finished product, this is the final query and it's driving me BAT SHIZZY