sql - count voting for different surveys -


well have table called surveys containing data , column in following manner. data collected feedback of people. each survey contains max 20 options.

form   survey1  survery2  survey3 survey4 survey5 survey6   1         16       1         2       5        11      9 2         9        6         16      5        11      9 3         8        3         2       5        11      9 4         16       1         2       5        11      9 5         16       6         4       5        11      9 6         15       1         2       5        11      9 7         16       1         2       5        11      9 8         15       1         16      5        11      9 . . . 

so on

each survey have option 1 16
need out put

survey 1

forms      options  4           16  2           15  1            8  1            9 

survey 2

forms      options  5            1  2            6  1            3 . . . . 

till 6 survey . need 6 survey records @ once . using sql server.

alright... i'm not sure understand want, based on you've described i'm going take stab @ it...

(select 'survey1' survey, survey1 forms, count(*) options some_table group survey, survey1 order options desc)  union  (select 'survey2' survey, survey2 forms, count(*) options some_table group survey, survey2 order options desc)  union  (select 'survey3' survey, survey3 forms, count(*) options some_table group survey, survey3 order options desc)  union  (select 'survey4' survey, survey4 forms, count(*) options some_table group survey, survey4 order options desc)  union  (select 'survey5' survey, survey5 forms, count(*) options some_table group survey, survey5 order options desc)  union  (select 'survey6' survey, survey6 forms, count(*) options some_table group survey, survey6 order options desc) 

this return single set of results option, , number of times appeared in column specific survey. added column able tell results coming survey.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -