Re: SUM not matching up on a JOIN - Mailing list pgsql-sql

From Tom Lane
Subject Re: SUM not matching up on a JOIN
Date
Msg-id 11414.1130359913@sss.pgh.pa.us
Whole thread Raw
In response to SUM not matching up on a JOIN  (Tyler Kellen <sleekcode@gmail.com>)
List pgsql-sql
Tyler Kellen <sleekcode@gmail.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


pgsql-sql by date:

Previous
From: Mario Splivalo
Date:
Subject: Re: RETURNS SETOF primitive returns results in parentheses
Next
From: "Thomas F. O'Connell"
Date:
Subject: Re: SQL Functions