Created
October 13, 2020 10:08
-
-
Save chanakaDe/0a4d0e89e0f13dd818e0d3aa8437158b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#not_null_order_count | |
select count(*) not_null_order_count, DATE_FORMAT(orders.created_at, "%Y-%m-%d") as order_date from `orders` inner join `order_items` on `order_items`.`order_id` = `orders`.`id` where exists (select * from `order_items` where `orders`.`id` = `order_items`.`order_id` and exists (select * from `articles` where `order_items`.`article_id` = `articles`.`id` and `manufacturer_id` = ?)) and `order_items`.`tariff_id` is not null and `orders`.`created_at` between ? and ? group by `order_date` order by `order_date` asc | |
#null_order_count | |
select count(*) null_order_count, DATE_FORMAT(orders.created_at, "%Y-%m-%d") as order_date from `orders` inner join `order_items` on `order_items`.`order_id` = `orders`.`id` where exists (select * from `order_items` where `orders`.`id` = `order_items`.`order_id` and exists (select * from `articles` where `order_items`.`article_id` = `articles`.`id` and `manufacturer_id` = ?)) and `order_items`.`tariff_id` is null and `orders`.`created_at` between ? and ? group by `order_date` order by `order_date` asc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment