[Courses] [Postgresql] Week 5: Even More SQL
Matthias Urlichs
smurf at smurf.noris.de
Tue Feb 26 21:05:38 UTC 2008
Hi,
Julie Pichon:
> I was wondering if anyone could provide an example where a CROSS JOIN
> would be useful?
Let's say I have a table of zip codes (and their geo coordinates). I
want to pre-populate a table of distances so that I can use that for
fast sorting of users-who-have-nothing-interesting-in-common in my
matchmaking database. ;-)
I do
select z1.zip,z2.zip,z1.geo,z2.geo from ziplist z1, ziplist z2 \
where z1.zipcode < z2.zipcode;
and proceed from there.
--
Matthias Urlichs | {M:U} IT Design @ m-u-it.de | smurf at smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
- -
Nearly every complex solution to a programming problem that I
have looked at carefully has turned out to be wrong.
-- Brent Welch
More information about the Courses
mailing list