teknofil
|
| Posted: 06/10/2002, 8:22 PM |
|
I have a query which I'm having trouble constructing, and would appreciate any advice or help.
I have two fields I'm populating using a listbox with multiple selection enabled which I'd like to compare and select records where the records have items in common.
eg.
tbl_user
tbl_user.user_group
tbl_article
tbl_article.article_group
tbl_user.user_group has values like 1,3,5,6
tbl_article.article_group has values like 1,3
I thought of using a select statement like;
SELECT * FROM tbl_article WHERE tbl_article.article_group IN tbl_user.user_group
but this doesn't seem to work.
Can anyone help and let me know what I'm doing wrong ?
|
|
|
 |
wonko
|
| Posted: 06/10/2002, 11:35 PM |
|
you should try an INNER JOIN query like this:
SELECT tbl_user INNER JOIN tbl_article ON tbl_user.user_group = tbl_article.article_group WHERE tbl_user.user_group LIKE %1,3%
|
|
|
 |
teknofile
|
| Posted: 06/11/2002, 1:57 AM |
|
Thanks for the response, wonko, but wouldn't that limit me to using known values only, as opposed to variables ?
Could I substitute the LIKE %1,3% with LIKE tbl_article.article_group ? This would allow a much wider range of variables than if I have to hand code each one.
|
|
|
 |
|