SELECT address_type, date_from, customer_id FROM Customer_Addresses WHERE date_to != "2018-03-05 01:34:02" UNION SELECT address_type, date_from, customer_id FROM Customer_Addresses WHERE "address_id" <= 2 OR date_from != "2013-05-06 00:49:45" AND address_type != "House" <table_name> : Customer_Addresses col : customer_id | address_id | date_from | address_type | date_to row 1 : 5 | 6 | 2016-09-06 19:23:46 | House | 2018-02-25 15:34:58 row 2 : 14 | 5 | 2016-12-21 03:49:54 | House | 2018-03-13 21:20:21 row 3 : 2 | 2 | 2014-06-09 06:31:49 | Flat | 2018-03-02 21:56:40 row 4 : 10 | 6 | 2011-05-24 21:49:34 | House | 2018-03-18 12:45:44 row 5 : 14 | 2 | 2011-12-06 16:49:10 | Flat | 2018-02-24 20:18:08 row 6 : 10 | 1 | 2012-05-24 11:47:54 | House | 2018-03-14 20:26:33 row 7 : 7 | 3 | 2016-08-17 17:45:20 | Flat | 2018-03-16 14:09:24 row 8 : 4 | 9 | 2009-08-03 03:17:03 | House | 2018-03-15 23:45:59 row 9 : 3 | 7 | 2010-12-29 11:01:39 | House | 2018-03-22 02:54:10 row 10 : 12 | 6 | 2012-08-31 15:41:03 | Flat | 2018-03-02 23:42:49 row 11 : 12 | 11 | 2008-04-02 08:23:13 | Apartment | 2018-03-17 12:51:37 row 12 : 14 | 10 | 2011-08-18 09:40:49 | House | 2018-03-06 15:48:13 row 13 : 1 | 11 | 2014-12-20 18:58:32 | House | 2018-02-27 00:53:48 row 14 : 8 | 6 | 2013-05-06 00:49:45 | Flat | 2018-03-05 01:34:02 row 15 : 12 | 5 | 2017-11-01 10:59:35 | Flat | 2018-03-09 05:05:17 <table_name> : Customer_Addresses col : customer_id | address_id | date_from | address_type | date_to row 1 : 5 | 6 | 2016-09-06 19:23:46 | House | 2018-02-25 15:34:58 row 2 : 14 | 5 | 2016-12-21 03:49:54 | House | 2018-03-13 21:20:21 row 3 : 2 | 2 | 2014-06-09 06:31:49 | Flat | 2018-03-02 21:56:40 row 4 : 10 | 6 | 2011-05-24 21:49:34 | House | 2018-03-18 12:45:44 row 5 : 14 | 2 | 2011-12-06 16:49:10 | Flat | 2018-02-24 20:18:08 row 6 : 10 | 1 | 2012-05-24 11:47:54 | House | 2018-03-14 20:26:33 row 7 : 7 | 3 | 2016-08-17 17:45:20 | Flat | 2018-03-16 14:09:24 row 8 : 4 | 9 | 2009-08-03 03:17:03 | House | 2018-03-15 23:45:59 row 9 : 3 | 7 | 2010-12-29 11:01:39 | House | 2018-03-22 02:54:10 row 10 : 12 | 6 | 2012-08-31 15:41:03 | Flat | 2018-03-02 23:42:49 row 11 : 12 | 11 | 2008-04-02 08:23:13 | Apartment | 2018-03-17 12:51:37 row 12 : 14 | 10 | 2011-08-18 09:40:49 | House | 2018-03-06 15:48:13 row 13 : 1 | 11 | 2014-12-20 18:58:32 | House | 2018-02-27 00:53:48 row 14 : 8 | 6 | 2013-05-06 00:49:45 | Flat | 2018-03-05 01:34:02 row 15 : 12 | 5 | 2017-11-01 10:59:35 | Flat | 2018-03-09 05:05:17
col : address_type | date_from | customer_id row 1 : Apartment | 2008-04-02 08:23:13 | 12 row 2 : Flat | 2011-12-06 16:49:10 | 14 row 3 : Flat | 2012-08-31 15:41:03 | 12 row 4 : Flat | 2014-06-09 06:31:49 | 2 row 5 : Flat | 2016-08-17 17:45:20 | 7 row 6 : Flat | 2017-11-01 10:59:35 | 12 row 7 : House | 2009-08-03 03:17:03 | 4 row 8 : House | 2010-12-29 11:01:39 | 3 row 9 : House | 2011-05-24 21:49:34 | 10 row 10 : House | 2011-08-18 09:40:49 | 14 row 11 : House | 2012-05-24 11:47:54 | 10 row 12 : House | 2014-12-20 18:58:32 | 1 row 13 : House | 2016-09-06 19:23:46 | 5 row 14 : House | 2016-12-21 03:49:54 | 14