Skip to content

Instantly share code, notes, and snippets.

@kastner
Created February 4, 2009 22:53
Show Gist options
  • Select an option

  • Save kastner/58407 to your computer and use it in GitHub Desktop.

Select an option

Save kastner/58407 to your computer and use it in GitHub Desktop.
$sql = "SELECT c.name, c.cust_num, SUM(qty) bottles,
GROUP_CONCAT(h.order_num) orders
FROM orders o INNER JOIN hist h ON h.order_num = o.order_num
INNER JOIN users c ON c.cust_num = o.cust_num
WHERE o.order_num IN ! GROUP BY o.cust_num";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment