Author |
Topic |
pamyral_279
Posting Yak Master
143 Posts |
Posted - 2010-01-05 : 05:07:26
|
VID Question Answer 2 ---- A ------A102 ---- B ------A202 ---- C ------A382 -----D-------A404 --- A -------A104 --- B -------A224 --- C -------A374 --- D -------A425 --- A -------A105 --- B -------A225 --- C -------A395 --- D -------A428 --- A -------A118 --- B -------A228 --- C -------A368 --- D -------A43......A : (From A10 to A19) B: (From A20 to A29)C : (From A30 to A39) D:(From A40 to A49)Now i want to export format :Question is A and answer is A10 - 3 timesQuestion is A and answer is A11 - 1 times......Question is B and answer is A20 - 1 timesQuestion is B and answer is A22 - 3 times..........Question is C and answer is A36- 1 timesQuestion is C and answer is A37- 1 timesQuestion is C and answer is A38- 1 timesQuestion is C and answer is A39- 1 timesAny one help me ?Thank you very much. |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-01-05 : 05:22:47
|
select Question, Answer, count(*) as timesfrom tablegroup by Question, Answerorder by Question, Answer No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
pamyral_279
Posting Yak Master
143 Posts |
Posted - 2010-01-05 : 11:48:03
|
quote: Originally posted by webfred select Question, Answer, count(*) as timesfrom tablegroup by Question, Answerorder by Question, Answer No, you're never too old to Yak'n'Roll if you're too young to die.
Thank you very much. I want to ask more ?how to get sub select from above result of your statement,such as i want to order times field ....so on... |
 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-01-05 : 12:52:58
|
Can you give some example data and table structure?Because it is not easy without knowing your data and table structure. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
pamyral_279
Posting Yak Master
143 Posts |
Posted - 2010-01-05 : 21:51:31
|
quote: Originally posted by webfred Can you give some example data and table structure?Because it is not easy without knowing your data and table structure. No, you're never too old to Yak'n'Roll if you're too young to die.
If I follow of your statement :Question Answer Times--------------- 3--------------- 9--------------- 4--------------- 1I need to order by times :Question Answer Times--------------- 1--------------- 3--------------- 4--------------- 9Thank you very much. |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-01-05 : 22:14:25
|
change the order by statement toORDER BY times KH[spoiler]Time is always against us[/spoiler] |
 |
|
pamyral_279
Posting Yak Master
143 Posts |
Posted - 2010-01-06 : 03:16:08
|
quote: Originally posted by khtan change the order by statement toORDER BY times KH[spoiler]Time is always against us[/spoiler]
Sorry sir,I change :select Question, Answer, count(*) as timesfrom table group by Question, Answer order by Question, Answer,TimesIt's not affect.Result is not change. |
 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-01-06 : 04:11:02
|
KH meant:order by Question, Answer, Times No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
pamyral_279
Posting Yak Master
143 Posts |
Posted - 2010-01-06 : 04:58:16
|
quote: Originally posted by webfred KH meant:order by Question, Answer, Times No, you're never too old to Yak'n'Roll if you're too young to die.
Thanks but i when i do that,result is not my wishQuestion TimesA------- 1B------- 2A------- 3C-------- 4A--------22I need the folowing format :A -----1A -----3A -----22B-----2C-----4Question need to group and times need to order.Thank you very much. |
 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-01-06 : 05:05:00
|
order by Question, Times No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
pamyral_279
Posting Yak Master
143 Posts |
Posted - 2010-01-06 : 22:18:52
|
quote: Originally posted by webfred order by Question, Times No, you're never too old to Yak'n'Roll if you're too young to die.
Thanks for help ! :) |
 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-01-07 : 03:48:55
|
welcome  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|