Re: SUM not matching up on a JOIN

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tyler Kellen <sleekcode(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: SUM not matching up on a JOIN
Date: 2005-10-26 20:51:53
Message-ID: 11414.1130359913@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Tyler Kellen <sleekcode(at)gmail(dot)com> writes:
> Why is my discount total different when I
> left join the trans table to the totals?

Are you sure that trans_item.trans_id is unique and accounts for all the
existing values of trans.id? I don't see any unique index or foreign
key constraints in your \d output, so the database isn't enforcing that
condition for you ...

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Thomas F. O'Connell 2005-10-26 22:42:13 Re: SQL Functions
Previous Message Mario Splivalo 2005-10-26 19:57:54 Re: RETURNS SETOF primitive returns results in parentheses