Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Cross tabulations in SQL?

Cross tabulations in SQL?

From: Paul <paul_at_not.a.chance.ie>
Date: Mon, 11 Aug 2003 18:27:42 +0100
Message-ID: <MPG.19a1e26c3f31208098970a@news1.eircom.net>

Hi all,

I have a table for a membership system with many fields, but the relevant ones here are Gender (M, F, U (U is from a legacy system)), Category (Life, Senior, Junior & Leader) and County (26 values here, I'll use 3 as an example - Dublin, Cork and Mayo).

What I want is something like

Gender by County

| M | F | U |


Dublin	| 12	| 14	| 5	| 31
Cork	| 5	| 7	| 2	| 14
Mayo	| 6	| 6	| 3	| 15
---------------------------|----

| 23 | 27 | 10 | 50

What is the closest that I can come to doing this in SQL?

I have asked about this on a newsgroup that I frequent that deals with my db server of choice (Interbase Open Source) and have been told that I can do it in a Stored Proceedure, but even then I have to know in advance the number of entris in the Gender "table" for example.

If it's not possible at the moment, is it not worth considering as functionality that should be part of a db server's capabilities?

Do any servers do it at the moment?

Any ideas, debates, rants, URLs, references welcome!

Paul...

-- 

plinehan__AT__yahoo__DOT__com

C++ Builder 5 SP1, Interbase 6.0.1.6 IBX 5.04

p.s. just lacerated a tendon in left hand, so pls 
excuse typos and tricky abbrevs - TIA.
Received on Mon Aug 11 2003 - 12:27:42 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US