MySQL, if a value is in one of two columns, return the value from the other one
Posted
by erikric
on Stack Overflow
See other posts from Stack Overflow
or by erikric
Published on 2010-03-24T09:15:55Z
Indexed on
2010/03/24
9:23 UTC
Read the original article
Hit count: 364
Hi,
This might be an easy one, but I'm not really experienced with sql.
I have a table with two user_id columns, user1 and user2. This table contains some compared values between the two users.
I want to send in an user id, and return all the id's from the other user when the sent user is either user1 or user2.
I guess some sort of if test would do the trick, but I don't know how to do this in SQL.
Cheers
© Stack Overflow or respective owner