There is one way to make it really really fast, which is to have a SET column called userAttributes and one of the attibutes, lets say the first, is SET('loggedInUser'). Then you can SELECT .... WHERE !(userAttributes & 1), it should be faster because it wont have to compare the entire string- it can look at the BIGINT and just see that they're logged in.
Hi there, thanks to both of you.
rebelweb2007 i will test your idea.
eval(BadCode) can u please expand on how would the set attribute would work?
a bit more info:
there are two tables, one stores the user login and registration details, eg username, avatar, contact details & etc.
the second table has tags stored that relate to that user, the table are linked by userID in both table.
search is done in table two, as not all user will have tags, or want to be searchable.
the query looks more like this:
userId FROM (
search_tbl) WHERE (
userId != 22) AND (
name = 'blabla' OR
area = '12345' OR
hair = 'Black');" and so......
the query returns all the users ID that match the search. all ids are stored in a array, which is used to loop through and get the user details from table one.