RE: [Info-ingres] Re: case statement



There is a nifty crosstab feature in ms access
The "sql" looks like this:

TRANSFORM Count(Browser) AS CountOfBrowser
SELECT Country
FROM browser_country
GROUP BY Country
PIVOT Browser;

Generates ..

Country msIE_5 msIE_6 netscape_7 ...
AU 2 100 20
CA 10 2
US 10 200 30
....

Problem is I can never tell how wide the result set is going to be.



-----Original Message-----
From: info-ingres-admin@xxxxxxxxxxxxxxx
[mailto:info-ingres-admin@xxxxxxxxxxxxxxx] On Behalf Of Roy Hann
Sent: Thursday, 9 March 2006 1:54 AM
To: info-ingres@xxxxxxxxxxxxxxx
Subject: [Info-ingres] Re: case statement

"--CELKO--" <jcelko212@xxxxxxxxxxxxx> wrote in message
news:1141828129.551446.224880@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Anyone got any ideas how to get this down to a single line per
username? <<

Do not write code this way. Remember 1NF? Display is the job of the
front end, never the database.

AFAIK 1NF just says the RDBMS will treat the value of each attribute *as
if* it is atomic. Tables are 1NF just by definition.

Marty's result table is in fact 5NF if the permissions are orthogonal
and he says the external predicate is "The user identified by <username>
has permit_a status of <permit_a> and permit_b status of <permit_b> and
.... and permit_d status of <permit_d>".

However, hair-splitting aside, I reluctantly agree that given his
original table design this looks like a presentation problem that--in
general--the front-end should normally handle. :-)

Roy


_______________________________________________
Info-ingres mailing list
Info-ingres@xxxxxxxxxxxxxxx
http://mailman.cariboulake.com/mailman/listinfo.py/info-ingres


.