From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tyler Kellen <sleekcode@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: SUM not matching up on a JOIN
Date: Wed, 26 Oct 2005 16:51:53 -0400
Message-ID: <11414.1130359913@sss.pgh.pa.us> (raw)
In-Reply-To: <edc66ef00510261048w345cfa9fp13c69b3fc33dd301@mail.gmail.com>
References: <edc66ef00510261048w345cfa9fp13c69b3fc33dd301@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, sleekcode@gmail.com
Subject: Re: SUM not matching up on a JOIN
In-Reply-To: <11414.1130359913@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox