[SQL] Sum of Every Column

2002-10-23 Thread Tom Haddon
Hi Folks, I'm hoping to put together a query that generates a report on a table with a large number of boolean fields. This report has to be able to adapt to the number of fields in the table. Essentially, I want it to provide the sum of TRUE values for each field for a given subset of the table.

[SQL] Sum of Every Column

2002-10-23 Thread Tom Haddon
Hi Folks, I'm hoping to put together a query that generates a report on a table with a large number of boolean fields. This report has to be able to adapt to the number of fields in the table. Essentially, I want it to provide the sum of TRUE values for each field for a given subset of the table.

[SQL] Case Statement

2002-08-28 Thread Tom Haddon
undancy in the statement above such as "CASE WHEN agency_contact_info.id > 0 THEN 0 ELSE 0 END" and "agency_contact_info.id > 0" - this is because it is being built dynamically, and it makes it easier to build the addition blocks of the statement. Thanks in advance, Tom __

Re: [SQL] Add Primary Key to a Table

2002-08-02 Thread Tom Haddon
Hi Josh, I think that solves it for me - I'm using 7.1.3 - will upgrade appropriately. Thanks, Tom -Original Message- From: Josh Berkus [mailto:[EMAIL PROTECTED]] Sent: Friday, August 02, 2002 4:20 PM To: Tom Haddon; [EMAIL PROTECTED] Subject: Re: [SQL] Add Primary Key to a

[SQL] Add Primary Key to a Table

2002-08-02 Thread Tom Haddon
uot;id". I had thought the best way to do this was to use SELECT INTO and then try to alter the tables to include PRIMARY and FOREIGN keys where applicable. Is there a better way to do this? Thanks, Tom ___ Tom Haddon IT Director The Better Health Foundation 414 T

FW: [SQL] Case Statement

2002-07-31 Thread Tom Haddon
uilt in any case. Thanks, Tom -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Stephan Szabo Sent: Wednesday, July 31, 2002 4:17 PM To: Tom Haddon Cc: [EMAIL PROTECTED] Subject: Re: [SQL] Case Statement On Wed, 31 Jul 2002, Tom Haddon wrote: > Hi

[SQL] Case Statement

2002-07-31 Thread Tom Haddon
Hi Folks, Pretty basic one here. I'm trying to do a SELECT statement that includes a CASE structure that will be used in the ORDER BY clause, and I want the CASE structure to evaluate a bunch of criteria and in each case increment its value by a certain amount: SELECT id, description CASE