Skip to content

Instantly share code, notes, and snippets.

@phuclh
Created February 7, 2020 01:02
Show Gist options
  • Save phuclh/e37c58f6498e9e7d621ee42eb6adae19 to your computer and use it in GitHub Desktop.
Save phuclh/e37c58f6498e9e7d621ee42eb6adae19 to your computer and use it in GitHub Desktop.
select * from `users` []
select `tasks`.*, `task_user`.`user_id` as `pivot_user_id`, `task_user`.`task_id` as `pivot_task_id`, `task_user`.`campaign_id` as `pivot_campaign_id` from `tasks` inner join `task_user` on `tasks`.`id` = `task_user`.`task_id` where `task_user`.`user_id` in (1, 2) and `end_at` >= ? and not exists (select * from `appraisals` where `tasks`.`id` = `appraisals`.`task_id`) or exists (select * from `appraisals` where `tasks`.`id` = `appraisals`.`task_id` and `percent` != ?) ["2020-02-07",100]
select `users`.*, `task_user`.`task_id` as `pivot_task_id`, `task_user`.`user_id` as `pivot_user_id`, `task_user`.`campaign_id` as `pivot_campaign_id` from `users` inner join `task_user` on `users`.`id` = `task_user`.`user_id` where `task_user`.`task_id` in (12, 13) []
select * from `campaigns` where `campaigns`.`id` in (2) []
select `users`.*, `campaign_user`.`campaign_id` as `pivot_campaign_id`, `campaign_user`.`user_id` as `pivot_user_id` from `users` inner join `campaign_user` on `users`.`id` = `campaign_user`.`user_id` where `campaign_user`.`campaign_id` in (2) []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment