Archive for May 9th, 2007

 

6A 4B 98 65 B6 B3 84 7D 4C 17 94 37 04 0F 6B 4E

May 09, 2007 in Random

Found this via slashdot:

You Can Own an Integer Too — Get Yours Here

6A 4B 98 65 B6 B3 84 7D 4C 17 94 37 04 0F 6B 4E, is now mine.

Hands off n00bs, or I bring out the DMCA spam cannon…

Ambiguous Column Names & Postgres Joins

May 09, 2007 in PostgreSQL

Most people working with postgres have probably encountered something like this before:

SELECT
instrument,
priceband,
pounds
FROM   tbl_instruments,
tbl_prices
WHERE   tbl_instruments.priceband=tbl_prices.priceband;
ERROR:  column reference "priceband" is ambiguous

Although that’s normal behavior according to the SQL standard, and very easy to fix using ‘tbl_instruments.priceband’ in the SELECT, it kind-of doesn’t make sense given that WHERE clause: both tbl_instruments.priceband and tbl_prices.priceband will yeild the same value. I found the following in the Postgres mailing archives (imo, a much neater solution than qualifying the column names):

SELECT
instrument,
priceband,
pounds
FROM
tbl_instruments
JOIN
tbl_prices USING (priceband);