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

From Dinesh Visweswaraiah
Subject Re: SQL Intersect like problem
Date
Msg-id jUsT.aNoTheR.mEsSaGe.iD.104454548526934@trailblazingsolutions.com
Whole thread Raw
In response to SQL Intersect like problem  ("Dinesh V" <dinesh@trailblazingsolutions.com>)
Responses Re: SQL Intersect like problem
List pgsql-novice
Hi Oliver,

Actually the story is a little different.  I used Invoice and Product
and Quantity because everybody understands those.  Reality is that
this is a table that has AuthorizationSetId, UserId and Privileges.
Objects in my application have a set of authorizations with specified
userid and privileges, specifying who is permitted to do what. The
Idea is to identify a AuthorizationSetId so that when the set of
UserId and Privileges change, I can reuse a AuthorizationSetId rather
than create a new one.  In fact without reuse, there is no point
in having a AuthorizationSetId in the first place.

There will be some sets that get discarded and will be lying in the
database.  I was planning on having a periodic (say weekly) cleanup
process that will delete these unused sets.

Since these details were auxilliary to the real problem I thought
maybe I can avoid confusing people.  I ended up doing exactly that
:-(

To paraphrase the situation-
Given a Master/Detail relationship.  How to find a Master from the
Details.  Which is the reverse of what is usually done.  Given a
Master we find Details.

Hope this clarifies things.

Thanks,
Dinesh
At 06 February 2003, Oliver Elphick <olly@lfix.co.uk> wrote:

>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
>
>---------------------------(end of broadcast)-------------------
--------
>TIP 3: if posting/reading through Usenet, please send an appropriate
>subscribe-nomail command to majordomo@postgresql.org so that your
>message can get through to the mailing list cleanly
>



Dinesh
Cell:703-725-4153
Email:dinesh@trailblazingsolutions.com
Web Site:http://www.trailblazingsolutions.com/dinesh

The significant problems we face cannot be solved by the same level
of thinking that created them  - Albert Einstein









pgsql-novice by date:

Previous
From: Thomas Adam
Date:
Subject: Re: Favorite Linux Editor for PostgreSQL Scripts?
Next
From: Aarni Ruuhimäki
Date:
Subject: Re: Favorite Linux Editor for PostgreSQL Scripts?