E
E
exxagw2015-10-01 00:41:53
MySQL
exxagw, 2015-10-01 00:41:53

How to select records from a table by two parameters?

There is a base `test`
id -- from -- to
1 -- 2 -- 1
2 -- 5 -- 1
3 -- 1 -- 2
4 -- 5 -- 9
5 -- 5 -- 13
6 -- 20 -- 21
7 -- 67 -- 1
how to get all records where from or to = 1? Y get the difference from them, i.e. get:
2, 5, 67

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Valera Karmanov, 2015-11-13
@motokraft

how to get all records where from or to = 1?

or
if you do it like this...
then we will get no records, since there is no record in which to and form contain 1
You can, of course, use the conditions by which to determine which column to display data ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question