Skip to content
Advertisement

Select from 2 tables with conditions

I need a SQL query, for multiple condition select from 2 tables.

I want to get all rows so that I get all order_row rows from table2 which are not present in table1 and order_row rows from table2 whose timestamp is newer in table2 than table1. And checks only rows from table 2 where timestamp is newer than 2016-11-03.
Result must be:

Advertisement

Answer

This should do it:

Demo here

Edit: If you want only records from table2 newer than '2016-11-03' to be considered, then simply add:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement