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.
In reply to Re^3: Feasability of quick generation of complex report from large db?
by pc88mxer
in thread Feasability of quick generation of complex report from large db?
by punch_card_don
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |