align-toparrow-leftarrow-rightbackbellblockcalendarcamerachatcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-crosscrosseditfacebookglobegoogleimagesinstagramlocation-pinmagnifying-glassmailmoremuplabelShape 3 + Rectangle 1outlookpersonplusImported LayersImported LayersImported Layersshieldstartwitteryahoo

The San Diego PostgreSQL Meetup Group Message Board › March 2011 Meetup

March 2011 Meetup

Guyren G H.
gisborne
Santee, CA
Post #: 3
Discussion of the March meetup
Guyren G H.
gisborne
Santee, CA
Post #: 4
How I format my SQL:

SELECT
..foo,
..bar as baz,
..bip
FROM
..table1 JOIN
..table2 ON (something) JOIN
..table3 ON (something_else)
WHERE (
....x = 1 AND
....y = 2 AND
....z = someFn(a))
..OR (
....a = 3 AND
....b = a)
..OR NOT (
......z = y
....OR
......a = b AND
......c = d)
ORDER BY
..foo

ie put all the things that you have by default on the right, and use indentation to show bracketing

Note: stupid site strips out leading spaces, so I used periods.
Guyren G H.
gisborne
Santee, CA
Post #: 5
How to quickly find the next record:

SELECT
..*
FROM
..sometable
WHERE
..name > (
....SELECT
......name
....FROM
......sometable
....WHERE
......id = <current_id>)
ORDER BY
..name
LIMIT 1

For the previous record, do ... WHERE name < ... ORDER BY name ASC ...

Note: stupid site strips out leading spaces, so I used periods
William D.
user 14390176
San Diego, CA
Post #: 1
Meeting code published here.

I updated per your comments.

http://www.utiliware....­
Powered by mvnForum

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy