Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.98 KB | None | 0 0
  1. 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;
  2. +---------------+--------------+
  3. | original_size | updated_size |
  4. +---------------+--------------+
  5. | 238992 | 146262 |
  6. +---------------+--------------+
  7. 1 row in set (8.21 sec)
  8.  
  9. mysql>
  10. 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;
  11. +---------------+--------------+
  12. | original_size | updated_size |
  13. +---------------+--------------+
  14. | 238992 | 6699 |
  15. +---------------+--------------+
  16. 1 row in set (8.31 sec)
  17.  
  18. 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;
  19. +---------------+--------------+
  20. | original_size | updated_size |
  21. +---------------+--------------+
  22. | 238992 | 12400 |
  23. +---------------+--------------+
  24. 1 row in set (9.53 sec)
  25.  
  26. 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;
  27. +---------------+--------------+
  28. | original_size | updated_size |
  29. +---------------+--------------+
  30. | 238994 | 12482 |
  31. +---------------+--------------+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement