Re: SQL Intersect like problem - Mailing list pgsql-novice

From Oliver Elphick
Subject Re: SQL Intersect like problem
Date
Msg-id 1044516162.14474.12.camel@linda.lfix.co.uk
Whole thread Raw
In response to Re: SQL Intersect like problem  (Bruno Wolff III <bruno@wolff.to>)
List 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@trailblazingsolutions.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.Elphick@lfix.co.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


pgsql-novice by date:

Previous
From: Andrew McMillan
Date:
Subject: Re: How can I speed up with query?
Next
From: Wim
Date:
Subject: Re: Postgres performace with large tables.