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