Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select ( select count(distinct l.id) from competitors c join locations l on l.id = c.product_id and c.customer_id = 462 and l.shop_id = 8821 join products p on p.id = l.id and p.shop_id = l.shop_id and p.delisted_at is null ) as original_size, ( select count(distinct l.id) from competitors c join locations l on l.id = c.product_id and c.customer_id = 462 and l.shop_id = 8821 join products p on p.id = l.id and p.shop_id = l.shop_id and p.delisted_at is null and p.updated_at >= '2018-01-16 01:00:00' and p.updated_at <= '2018-01-17 01:00:00' ) as updated_size;
- +---------------+--------------+
- | original_size | updated_size |
- +---------------+--------------+
- | 238992 | 146262 |
- +---------------+--------------+
- 1 row in set (8.21 sec)
- mysql>
- mysql> select ( select count(distinct l.id) from competitors c join locations l on l.id = c.product_id and c.customer_id = 462 and l.shop_id = 8821 join products p on p.id = l.id and p.shop_id = l.shop_id and p.delisted_at is null ) as original_size, ( select count(distinct l.id) from competitors c join locations l on l.id = c.product_id and c.customer_id = 462 and l.shop_id = 8821 join products p on p.id = l.id and p.shop_id = l.shop_id and p.delisted_at is null and p.updated_at >= '2018-01-17 01:00:00' and p.updated_at <= '2018-01-18 01:00:00' ) as updated_size;
- +---------------+--------------+
- | original_size | updated_size |
- +---------------+--------------+
- | 238992 | 6699 |
- +---------------+--------------+
- 1 row in set (8.31 sec)
- mysql> select ( select count(distinct l.id) from competitors c join locations l on l.id = c.product_id and c.customer_id = 462 and l.shop_id = 8821 join products p on p.id = l.id and p.shop_id = l.shop_id and p.delisted_at is null ) as original_size, ( select count(distinct l.id) from competitors c join locations l on l.id = c.product_id and c.customer_id = 462 and l.shop_id = 8821 join products p on p.id = l.id and p.shop_id = l.shop_id and p.delisted_at is null and p.updated_at >= '2018-01-18 01:00:00' and p.updated_at <= '2018-01-19 01:00:00' ) as updated_size;
- +---------------+--------------+
- | original_size | updated_size |
- +---------------+--------------+
- | 238992 | 12400 |
- +---------------+--------------+
- 1 row in set (9.53 sec)
- mysql> select ( select count(distinct l.id) from competitors c join locations l on l.id = c.product_id and c.customer_id = 462 and l.shop_id = 8821 join products p on p.id = l.id and p.shop_id = l.shop_id and p.delisted_at is null ) as original_size, ( select count(distinct l.id) from competitors c join locations l on l.id = c.product_id and c.customer_id = 462 and l.shop_id = 8821 join products p on p.id = l.id and p.shop_id = l.shop_id and p.delisted_at is null and p.updated_at >= '2018-01-18 01:00:00' and p.updated_at <= '2018-01-19 01:00:00' ) as updated_size;
- +---------------+--------------+
- | original_size | updated_size |
- +---------------+--------------+
- | 238994 | 12482 |
- +---------------+--------------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement