Re: Hellllp!

From: Bob Badour <bbadour_at_golden.net>
Date: Wed, 13 Aug 2003 10:16:38 -0400
Message-ID: <BPs_a.5987$pc6.385622128_at_mantis.golden.net>


"John Smith" <10001_john_smith_at_hotmail.com> wrote in message news:bhd5th$1072j8$1_at_ID-126646.news.uni-berlin.de...
> Hi, my boss doesnt believe in normalisation/referential integrity/database
theory PERIOD.
>
> I pay the cost everyday.
>
> Todays jaunt into insanity is as follows:
>
> We have a table of data (called Data) that contains 30 something fields
including:
>
> "Repair 1"
> "Amount 1"
> "Repair 2"
> "Amount 2"
> "Repair 3"
> "Amount 3"
>
> The repairs(1,2,3 up to three repairs per row in Data) contain
> repair codes that link to another table called "Repair Codes"
>
> I discussed the idea of having a "Repairs" table linked to each row in
> Data where a repair has taken place, but that was rebutted with
> "dont be a fucking twat", so anyway now he wants me to build a
> report that sums all the types of repairs in Rep1,2,3 and calculates
> their corresponding amounts. Eg:
>
> 5 A's 40
> 1 B 10
> etc for each repair code.
>
> Not an easy task, but can anyone have a go at this for me, I'm lost as
> to where to start.

I suggest you start by expressing the relation you wanted to use in the first place as a union of the repair1s, the repair2s and the repair3s. Then use that relation to answer your question. Depending on the capabilities of your dbms, you may have to create a named view or you may be able to nest the expression in the from clause of your query.

When your boss complains about performance, tell him not to be such a fucking twat. Received on Wed Aug 13 2003 - 16:16:38 CEST

Original text of this message