Skip to content

Instantly share code, notes, and snippets.

@geoffb
Forked from isaacs/example.sql
Created April 7, 2010 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geoffb/358584 to your computer and use it in GitHub Desktop.
Save geoffb/358584 to your computer and use it in GitHub Desktop.
-- I used to do it like this:
SELECT * FROM table WHERE
hurr
AND (foo = 'bar')
AND (bar = 'foo')
-- Then later I spaced it out even more:
SELECT
*
FROM
table
WHERE
hurr
AND
(foo = 'bar')
LIMIT
1
SELECT *
FROM table
WHERE hurr
AND (foo = 'bar')
AND (bar = 'baz')
LIMIT 1
SELECT a.foo,
a.bar,
a.baz,
b.foo,
b.bar
FROM table_a as a
INNER JOIN table_b as b
ON a.foo = b.foo
WHERE a.bar = 1 AND b.bar = 2
LIMIT 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment