Hi
I have the following query:
[code=sql]
SELECT user_id_pk, first_name, last_name, email
FROM users
LEFT JOIN status ON user_id_pk=user _id_fk
WHERE live='Y'
AND (status=1 OR status IS NULL)
AND user_id_pk IN (SELECT uid_csv FROM groups WHERE group_id_pk=1);
[/code]
The groups table contains a TEXT field with a comma seperated list such as:
1,10,14,25
When I write the query longhand (ie without the sub-select), it returns the correct rows. Otherwise it doesn't seem to recognise the list properly. I suppose this is because the uid_csv field is TEXT format. How can I use fix the query? Can I convert the format of the TEXT field so that it is recognised properly?
Thanks!
Henry
I have the following query:
[code=sql]
SELECT user_id_pk, first_name, last_name, email
FROM users
LEFT JOIN status ON user_id_pk=user _id_fk
WHERE live='Y'
AND (status=1 OR status IS NULL)
AND user_id_pk IN (SELECT uid_csv FROM groups WHERE group_id_pk=1);
[/code]
The groups table contains a TEXT field with a comma seperated list such as:
1,10,14,25
When I write the query longhand (ie without the sub-select), it returns the correct rows. Otherwise it doesn't seem to recognise the list properly. I suppose this is because the uid_csv field is TEXT format. How can I use fix the query? Can I convert the format of the TEXT field so that it is recognised properly?
Thanks!
Henry
Comment