Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 more information

Author  Topic 

csphard
Posting Yak Master

113 Posts

Posted - 2005-06-05 : 18:51:55
this one is good

SELECT srv_currentChildcare, Count(*) as mycount, CAST(Count(*) as float) * CAST( 100 as float) / Cast( ( SELECT Count(*) FROM college_survey where srv_college = 'Academy of Chinese Culture and Health Sciences ') as float) as percentage FROM college_survey where srv_college = 'Academy of Chinese Culture and Health Sciences 'GROUP BY srv_currentChildcare


this one is good

SELECT srv_campusChildcare, Count(*) as mycount, CAST(Count(*) as float) * CAST( 100 as float) / Cast( ( SELECT Count(*) FROM college_survey where srv_college = 'Academy of Chinese Culture and Health Sciences ') as float) as percentage FROM college_survey where srv_college = 'Academy of Chinese Culture and Health Sciences 'GROUP BY srv_campusChildcare


this one is good

SELECT srv_barriers, Count(*) as mycount, CAST(Count(*) as float) * CAST( 100 as float) / Cast( ( SELECT Count(*) FROM college_survey where srv_college = 'Academy of Chinese Culture and Health Sciences ') as float) as percentage FROM college_survey where srv_college = 'Academy of Chinese Culture and Health Sciences 'GROUP BY srv_barriers

it errors here

SELECT srv_maritalStatus, Count(*) as mycount, CAST(Count(*) as float) * CAST( 100 as float) / Cast( ( SELECT Count(*) FROM college_survey where srv_college = 'Academy of Chinese Culture and Health Sciences ') as float) as percentage FROM college_survey where srv_college = 'Academy of Chinese Culture and Health Sciences 'GROUP BY srv_maritalStatus


table used

CREATE TABLE [college_survey] (
[srv_id] [int] IDENTITY (1, 1) NOT NULL ,
[srv_college] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[srv_currentChildcare] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[srv_campusChildcare] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[srv_barriers] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[srv_barriersOther] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[srv_maritalStatus] [text] COLLATE Chinese_PRC_CI_AS NULL ,
[srv_ageGroup] [text] COLLATE Chinese_PRC_CI_AS NULL ,
[srv_gender] [text] COLLATE Chinese_PRC_CI_AS NULL ,
[srv_ethnicity] [text] COLLATE Chinese_PRC_CI_AS NULL ,
[srv_ethnicityOther] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[srv_highestEd] [text] COLLATE Chinese_PRC_CI_AS NULL ,
[srv_monthlyGross] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[srv_careNeededwhen] [text] COLLATE Chinese_PRC_CI_AS NULL ,
[srv_careNeededwhenOther] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[srv_currentLivingArrangements] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[srv_currentLivingArrangementsOther] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[srv_numChildren] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[srv_numChildren02] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[srv_numChildren25] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[srv_numChildren56] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[srv_numChildren6] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[srv_homeComputer] [text] COLLATE Chinese_PRC_CI_AS NULL ,
[srv_inputDate] [datetime] NOT NULL CONSTRAINT [DF_college_survey_srv_inputDate] DEFAULT (getdate())
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-06-05 : 18:54:04
If this is related to this problem here:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=50700

Please post in the original and do not start a new thread for it.
Go to Top of Page
   

- Advertisement -