Reputation: 15708
Take the following table as an example:
-------------------------
| time | start_time|
-------------------------
| 50 | 80 |
| 20 | 72 |
| 45 | 30 |
-------------------------
I would like a query which returns all rows where time
is less than the start_time
given in the corresponding row, this query should return:
-------------------------
| time | start_time|
-------------------------
| 50 | 80 |
| 20 | 72 |
-------------------------
Upvotes: 0
Views: 571
Reputation: 6346
If you want compare scalar with set. You can use "any" or "all" keyword. But i'm not sure that you have asked about it. ALL, ANY and SOME Comparison Conditions in SQL
select * from temp_table where
time < any (select start_time from temp_table)
select * from temp_table where
time < all (select start_time from temp_table)
Upvotes: 1
Reputation: 49260
select *
from tablename
where time < start_time
You can try this assuming both the columns are numeric.
Upvotes: 1