I am trying to run a query off of my mysql database using the IN operator.
SELECT usernum FROM usergroup WHERE emailmain IN ('blah@blah.com', 'rawr@rawr.com', 'e@e.com')
The query works but instead of outputing the usernum values in the order entered it outputs them in descending order. This is problematic because I need them to be aligned to the emails. I think it may have to do with the limit operator or by using an ORDER BY emailmain. I’ve tried that and it still doesn’t work because assuming the email doesn’t exist in the database it won’t correspond to the memory location in the array.
The most important thing to me is that I know the emails that aren’t in the database.
Any help would be appreciated!
If you are creating the IN string dynamically, you don’t have to create a table every time you run the query – you can use an inline view, populated in the same way as the IN string, like so: