in reply to Re^2: Feasability of quick generation of complex report from large db?
in thread Feasability of quick generation of complex report from large db?
I don't think you want a 12,000 column table. Just use an 'intersection' table which has just two columns, one for the company and the other for the question they answered in the affirmative. There would not be any rows for questions they answered 'no' to.So, all the info could have been put into one big 30,000 row x 12,000 +column table ...
Your example query can be performed using a self-join like this:
(It should be obvious that indexes on the 'company' and 'answer' column would be very helpful.)SELECT a.company from CA as a, CA as b where a.company = b.company and + a.answer = 'group_a' and b.answer = 'product_class_c';
Note that this method allows you to add more questions without having to change the schema of the table.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Feasability of quick generation of complex report from large db?
by punch_card_don (Curate) on Feb 06, 2008 at 17:55 UTC | |
by pc88mxer (Vicar) on Feb 06, 2008 at 18:36 UTC | |
by punch_card_don (Curate) on Feb 06, 2008 at 19:47 UTC | |
by Jenda (Abbot) on Feb 07, 2008 at 00:48 UTC | |
by pc88mxer (Vicar) on Feb 06, 2008 at 20:00 UTC |