Skip to content

Instantly share code, notes, and snippets.

@5a494d
Last active February 10, 2017 19:11
Show Gist options
  • Save 5a494d/69952b2fcd058d249bc92fdfde431e19 to your computer and use it in GitHub Desktop.
Save 5a494d/69952b2fcd058d249bc92fdfde431e19 to your computer and use it in GitHub Desktop.
multiple clauses with mysql
SELECT
T0.client_id, name, exts, vms, ivrs, queues, conf10, conf20, conf30
FROM
vw_clients T0
left join vw_exts T1 on T0.client_Id=T1.client_id
Left join vw_vms T2 on ...
...
Where ...
SELECT
SUM(category='x') as tot_x,
SUM(category='y') as tot_y,
SUM(category='z') as tot_z
FROM table
WHERE cid='290463' and category in ('x', 'y', 'z')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment