Forum Discussion
micha80 Try to use the clause 'IN' per the User Resource example:
SELECT id, login FROM users WHERE roles.name='Administrator' SELECT * FROM users WHERE roles.name IN ('Administrator', 'Community Manager')
Hi Paolo,
thanks for the reply. I tried the following:
1. SELECT * FROM users WHERE roles.name = 'Role1' AND roles.name = 'Role2'
Result Count: 4
Out of the 4 items 3 user have only the role "Role1" and 1 user has both roles assigned.
2. SELECT * FROM users WHERE roles.name IN ('Role1') AND roles.name IN ('Role2')
Same results like descripted in 1.
3. SELECT * FROM users WHERE roles.name IN ('Role1', 'Role2')
Result Count: 5
Out of the 5 items 3 user have only the role "Role1", 1 user has only the role "Role2" and 1 user has both roles assigned.
Only the user with both roles assigned is correct. The others a wrong.
Regards,
Michael
- OlivierS10 years agoLithium Alumni (Retired)
micha80 sorry, missread your issue ... There isn't something in the documentation saying you could use 'AND'. But nothing saying you shouldn't !
A quick workaround would be to add another role to the users if they have both roles, then use the newly created role in your API call.
But I would agree with PaoloT, raise a case with Lithium support to check if it's an expected behaviour.
- micha8010 years agoExpert
Hi Paolo,
hi Olivier,
I will open a ticket.
Thanks,
Michael
Related Content
- 7 years ago
- 11 years ago
- 4 years ago