Query help - Posted (1664 Views)
Average Member
Jorrit787
Posts: 681
681
I have a table in my Access DB that contains a field with lists of comma-delimited usergroup IDs. How can I select only those records in which the usergroup ID of the current user does not appear in the list of usergroup IDs in the database?
Something like this doesn't work:

SELECT * FROM TABLE WHERE " & m_usergroup & " NOT IN exclude_usergroups"

m_usergroup in this case could be "4", and a particular record could have an exclude_usergroups field value of "1,2,5,6".
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Snitz Forums Admin
ruirib
Posts: 26364
26364
What is the table that has the usergroups to be exclused?
Posted
Forum Admin
HuwR
Posts: 20611
20611
you need to do

SELECT * FROM TABLE WHERE '" & m_usergroup & "' NOT IN exclude_usergroups"
Posted
Average Member
Jorrit787
Posts: 681
681
So, late response, but better late than never, right?
I tried your suggestion Huw, but I get this error:

Code:
Microsoft JET Database Engine error '80040e14'

In operator without () in query expression 'sectionid=103 AND '0' NOT IN usergroup'.
Posted
Forum Admin
HuwR
Posts: 20611
20611
try
SELECT * FROM TABLE WHERE '" & m_usergroup & "' NOT IN (exclude_usergroups)"
 
You Must enter a message