I have a table named q_mails that has six cols:
id - to_nick - from_nick - threadid - left_folder - right_folder
id is a counter, to_nick is a username, from_nick is also a username, threadid contains a number and two user ids, like this: 908723487|user1|user2
in col threadid, user1 "owns" col left_folder and user2 "owns" right_folder. I don't know which user in threadid that will be first in the "list", ssometimes the threadid will look like: 908723487|user2|user1
I want a query that looks like:
or
the right_folder or left_folder column in the query should be set depending on where the user is located in col threadid, on the left or the right...
Is it possible to do this with only one query?? I you don't understand what I mean, ask for more clarification please
id - to_nick - from_nick - threadid - left_folder - right_folder
id is a counter, to_nick is a username, from_nick is also a username, threadid contains a number and two user ids, like this: 908723487|user1|user2
in col threadid, user1 "owns" col left_folder and user2 "owns" right_folder. I don't know which user in threadid that will be first in the "list", ssometimes the threadid will look like: 908723487|user2|user1
I want a query that looks like:
Code:
select * from q_mails where to_nick='user1' and left_folder="trash"
Code:
select * from q_mails where to_nick='user2' and right_folder="trash"
the right_folder or left_folder column in the query should be set depending on where the user is located in col threadid, on the left or the right...
Is it possible to do this with only one query?? I you don't understand what I mean, ask for more clarification please