Re: SQL Intersect like problem

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Dinesh Visweswaraiah <dinesh(at)trailblazingsolutions(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org, Bruno Wolff III <bruno(at)wolff(dot)to>
Subject: Re: SQL Intersect like problem
Date: 2003-02-06 07:22:42
Message-ID: 1044516162.14474.12.camel@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wed, 2003-02-05 at 16:39, Bruno Wolff III wrote:
> On Wed, Feb 05, 2003 at 10:17:09 -0500,
> Dinesh Visweswaraiah <dinesh(at)trailblazingsolutions(dot)com> wrote:
> > Bruno,
> >
> > I am sorry for being very clear. The need is to identify an InvoiceId
> > from a *set* of ProductId and Quantity values. A simple join will
> > not work because it is not one value of ProductId and one value of
> > Quantity.

Unless you are clearing these tables very frequently, it seems to me you
will very soon find duplicate combinations. It is very likely (perhaps
not in your case?) that customers will repeat an order with the same
products and quantities as before, or that more than one customer will
send in the same order.

Why do you not add the invoiceid to the table with the products and
quantities? This is the standard way to identify invoice lines with the
invoice.

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight, UK http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"He hath not dealt with us after our sins; nor rewarded
us according to our iniquities. For as the heaven is
high above the earth, so great is his mercy toward
them that fear him. As far as the east is from the
west, so far hath he removed our transgressions from
us." Psalms 103:10-12

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Wim 2003-02-06 07:39:12 Re: Postgres performace with large tables.
Previous Message David Nicely 2003-02-06 03:14:07 Re: PL/Perl on HPUX