0

I'm trying to query by a list of value pair.

For example:

src   dst   byte
 a     b     16
 c     d     20
 e     f     50
 a     f      0

I want to query by src and dst in one Query to get (a, b, 16) and (e, f, 50).

SELECT *
FROM table
WHERE src IN ( a, e )
AND dst IN (b, f )

But this statement also gives me (a, f, 0).

Is it possible to get (a, b, 16) and (e, f, 50) in one query?

3
  • have you got your expected answer? Commented Apr 25, 2014 at 6:15
  • I am wondering if there is any other method besides WHERE src = 'a' AND dst = 'b' OR src = 'e' AND dst = 'f'? Commented Apr 25, 2014 at 6:40
  • What you want other? give example Commented Apr 25, 2014 at 6:41

2 Answers 2

2

Try this:

SELECT *
FROM table
WHERE src = 'a' AND dst = 'b'
   OR src = 'e' AND dst = 'f'
Sign up to request clarification or add additional context in comments.

1 Comment

Is there any other option?
1

Do simple things like

SELECT *
FROM your_table
WHERE (src = 'a' AND dst = 'b')
   OR (src = 'e' AND dst = 'f');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.