Skip to content

Instantly share code, notes, and snippets.

@xirukitepe
Created August 13, 2020 01:43
Show Gist options
  • Save xirukitepe/e49507d307438df827a8904e4cc15b1d to your computer and use it in GitHub Desktop.
Save xirukitepe/e49507d307438df827a8904e4cc15b1d to your computer and use it in GitHub Desktop.
SQL Query for LCL hire rate analysis
EXPLAIN for: SELECT `jobs`.* FROM `jobs` INNER JOIN `bids` ON `bids`.`job_id` = `jobs`.`id` INNER JOIN `suburbs` ON `suburbs`.`id` = `jobs`.`suburb_id` WHERE (jobs.status NOT IN ('drafted','rejected') AND (jobs.status = 'stopped' OR bidding_closes_on < DATE(CURRENT_TIMESTAMP + INTERVAL 10 HOUR))) AND (DATE(jobs.created_at) >= '2020-06-09') AND (suburbs.region IN ('Sydney','Melbourne','Brisbane')) GROUP BY bids.job_id HAVING (count(bids.job_id) >= 1) ORDER BY jobs.id desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment