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
 Transact-SQL (2000)
 Dynamic Column name in a query

Author  Topic 

cocorico
Starting Member

1 Post

Posted - 2009-04-29 : 08:58:43
Dear all,

Is it possible to run this query ? dynamic column name

select label,(((select COUNT(id) from dbo.satis_survey where status = 10 and lkpsorular.soru IN (4,5)) - lkpsorular.katsayi * (select COUNT(id) from dbo.satis_survey where status = 10 and lkpsorular.soru IN (1,2,3)))/(select COUNT(id) from dbo.satis_survey where status = 10 and lkpsorular.soru IN (1,2,3,4,5)))*100 from lkpsorular

you will find lkpsorular table at below...


lkpsorular

soru katsayi
s1 2
s3_1 1,8
s3_2 2,5
s3_3 1,5
s3_4 2
s3_5 1,5
s3_6 1,5
s3_7 2
s6_1 1,5
s6_2 1,5
s6_3 1,8
s6_4 1,5
s6_5 1,5
s6_6 2
s6_7 2
s6_8 2
s6_9 1,5
s6_10 2
s6_11 2
s6_12 2
s6_13 2

Regards,
   

- Advertisement -