Link to home
Start Free TrialLog in
Avatar of BeginningWebDesign
BeginningWebDesign

asked on

Change data layout

Hi
Can anyone modify the code below, so that it returns the following:

PollQuestionText returned once

PollYesText  PollYesValue
PollNoText PollNoValue

Current Output
Are you a good programmer | Yes | 0 | No | 1

Output would be:
Are you a good programmer
Yes 0
No   1

I need it to display in a radiobuttonlist that has 2 option
George
SELECT PollQuestionText AS PollQuestionText,
		   PollYesText AS PollYesText,
		   PollYesValue AS PollYesValue,
		   PollNoText AS PollNoText,
		   PollNoValue AS PollNoValue
	FROM dbo.Website_Polls

Open in new window

Avatar of momi_sabag
momi_sabag
Flag of United States of America image

you can try

SELECT PollQuestionText AS PollQuestionText + char(13) + char(10) +
               PollYesText AS PollYesText +
               PollYesValue AS PollYesValue + char(13) + char(10) +
               PollNoText AS PollNoText +
               PollNoValue AS PollNoValue
      FROM dbo.Website_Polls
Avatar of BeginningWebDesign
BeginningWebDesign

ASKER

Hi momi sabag
I get the following error:

Incorrect syntax near '+'.

George
are all the values of type varchar?
Hi momi_sabag:

No PollYesValue and PollNoValue are int

George
ASKER CERTIFIED SOLUTION
Avatar of Emes
Emes
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks Emes: