Advertisement
Guest User

Untitled

a guest
Nov 11th, 2013
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.21 KB | None | 0 0
  1. SELECT
  2.     a.foo, COUNT(*) AS c
  3. FROM table1 a
  4.     INNER JOIN table2 b ON a.id = b.id
  5.         AND a.foo = b.bar
  6.     INNER JOIN (
  7.         SELECT id
  8.         FROM table3
  9.     ) AS t ON t.id = a.id
  10. WHERE a.id = 1
  11.     AND a.foo = 1
  12. GROUP BY a.foo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement