Re: some external sql not working in psql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kashmir <kashmir_us_1999(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: some external sql not working in psql
Date: 2009-04-08 20:42:06
Message-ID: 19467.1239223326@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Kashmir <kashmir_us_1999(at)yahoo(dot)com> writes:
> being a sql-lamer, i used some query builder help to build my query (which served me quite well in the past for all my 'complicated' sqls), and was suggested for f_rrd_id=444 to use something as:
> SELECT
> td_fetch1m_by_rrd_id.f_timestamp,
> td_fetch_by_rrd_id.f_ds,
> td_fetch_by_rrd_id.f_ds,
> td_fetch1m_by_rrd_id.f_ds,
> td_fetch1m_by_rrd_id.f_us
> FROM td_fetch_by_rrd_id
> RIGHT JOIN td_fetch1m_by_rrd_id ON td_fetch_by_rrd_id.f_timestamp=td_fetch1m_by_rrd_id.f_timestamp
> WHERE td_fetch1m_by_rrd_id.f_rrd_id=444
> ORDER BY td_fetch1m_by_rrd_id.f_timestamp;

Seems like that should be a LEFT JOIN, if you're expecting there to be
missing values in td_fetch_by_rrd_id rather than the other. The WHERE
and ORDER BY clauses don't look right either unless LEFT was meant.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Robert Treat 2009-04-08 21:06:44 Re: Are there performance advantages in storing bulky field in separate table?
Previous Message Chris Browne 2009-04-08 20:31:33 Re: Are there performance advantages in storing bulky field in separate table?