Question : How can I present multiple percentages in MSSQL server derived from a single cell then over multiple rows?

Hello Experts,
I have a survey that I have created using a simple forms program. The form saves it's data into a table in MSSQL 2005. I need to display this data using a simple grid app that can handle only one select statement. Some of the questions contain list boxes with multiple selects within them. On those I have the data being saved to a single row cell as "a,b,c,d,e,f,g" (i.e. if all selections were selected) and or "a,c,f,g". What I need to do when returning these results is present a single row that has taken all of the "a", "b" "c" etc. answers and totals them then displays it in a single cell with multiple carriage returns. An example would be:
__________________
| Question 1c. Results |
| 70% answered a      |
| 10% answered b      |
| 03% answered c      |
__________________
and so on...
On the other questions I have entries such as dollar amounts and regular integers. These need to be averaged across all rows. I am novice at SQL so please be gentle with me :) It's probably fairly strait forward for someone who is much better at this then me. I have attached an image of the survey for reference.
I have begun a query but I am getting a bit crossed up and could really use a helping hand. Thank you all whom respond in advance!

Survey Form:
 
 
Client side of survey
325255
 


My table structure:
 
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
USE [safcdb2]
GO
/****** Object:  Table [dbo].[MotorVehicleResponseSurvey]    Script Date: 07/11/2010 11:35:50 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MotorVehicleResponseSurvey](
	[MotorVehicleResponseSurveyID] [int] IDENTITY(1,1) NOT NULL,
	[1] [nvarchar](500) NULL,
	[1a] [int] NULL,
	[1b] [int] NULL,
	[1c] [nvarchar](100) NULL,
	[2] [int] NULL,
	[3] [int] NULL,
	[4] [nvarchar](50) NULL,
 CONSTRAINT [PK_MotorVehicleResponseSurvey] PRIMARY KEY CLUSTERED 
(
	[MotorVehicleResponseSurveyID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]


Table Data
 
 
 

Answer : How can I present multiple percentages in MSSQL server derived from a single cell then over multiple rows?

Looks fine to me.  Try this for a test.  The next question is where are you getting "$confirmed" and why do you think it contains "0000-00-00"?
1:
2:
3:
4:
$confirmed = "0000-00-00";
if($confirmed=="0000-00-00"){
echo "Yes";
}
Random Solutions  
 
programming4us programming4us