Joe Filler
Joe Filler

Reputation: 13

How do you select 2 rows from the same table in MySQL, with different conditions for each?

i have a table I am using for referrals. The table has 3 columns: ID, FriendCode, and Referred. I want to

ID | Referred | FriendCod 1 | 1 | 100 2 | 0 | 200

I want to select 1 from referred column and 2 from ID column, and what I have is an ID of 1(current user) and FriendCode 200.

How do I go about this?

Thanks in advance!

Upvotes: 0

Views: 1954

Answers (1)

Jens
Jens

Reputation: 69440

Is:

select ID from tablename where ID=1
union 
select ID from tablename where FriendCode=100

what you want?

Upvotes: 1

Related Questions