[Zope] Get Column Names from SQL Query?

Casey Duncan cduncan@kaivo.com
Wed, 04 Apr 2001 14:24:55 -0600


"Schmidt, Allen J." wrote:
> 
> I have a need for this type also.
> One table lists items with several varchar fields and about 40 Boolean
> fields (various options each item has or doesn't have).
> Another table (options) has 2 columns - option and optionDescription. The
> option is the column name of each of the Boolean fields and the
> optionDescription is a text description of each option.
> 
> I need a query that will get all the details of an item and if any of the 40
> options is set with a TRUE, then display the optionDescription from the
> 'options' table - not just a 1 or 0.
> 
> So, I will need to compare the option name with the column name from the
> item table.
> 
> SLIGHTLY off-topic but someone else started it! <8^)
> 
> Thanks
> 
> Allen
> 

Yikes! This sounds like a database normalization issue. To make this
easy, this many boolean flags should be rows in the database rather than
fields. Unless size is a huge concern (only true values would actually
need rows though), I think you should consider normalizing your db.

-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>