I am struggling again with a sql statement , this time it should count two coulmns and display them , but the sum of this two columns should be displayed as well where the sum of the most top 10 are shown.
I am building it like this but ofcourse it gives error since my sql is poorly done:
SelectCommand="SELECT top 10 Finals WHERE EXISTS ,(SELECT [Winner], COUNT(*) Winner1 FROM [Tournament] ), ( SELECT [Runner], COUNT(*) Runner1 FROM [Tournament]) From [Tournament] AND Winner1+Runner1=Finals GROUP BY Finals "></asp:SqlDataSource>
I have all five fields above declared as asp:BoundField DataFields hopefully this should be ok.
Thanks to all users of this site that have helped me earlier and I am sure its users will help me out once again!
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Nice solution man!!! i needed to find a way to make this on my website and thanks to asp.net i can do it, seriously im very happy about it, nice updates, im waiting for the next bro!! a hug and goodbye to all ;) this is my website and this is how i did it
thanks to all your help guys!! thank u again
Abogados Madrid
Member
15 Points
19 Posts
SQL sub statement in a aspx file for c# in visual studio 13
Dec 24, 2015 10:13 AM|stenmananders|LINK
I am struggling again with a sql statement , this time it should count two coulmns and display them , but the sum of this two columns should be displayed as well where the sum of the most top 10 are shown.
I am building it like this but ofcourse it gives error since my sql is poorly done:
SelectCommand="SELECT top 10 Finals WHERE EXISTS ,(SELECT [Winner], COUNT(*) Winner1 FROM [Tournament] ), ( SELECT [Runner], COUNT(*) Runner1 FROM [Tournament]) From [Tournament] AND Winner1+Runner1=Finals GROUP BY Finals "></asp:SqlDataSource>
I have all five fields above declared as asp:BoundField DataFields hopefully this should be ok.
Thanks to all users of this site that have helped me earlier and I am sure its users will help me out once again!
Merry Christmas and Happy New Year!
All-Star
40565 Points
6233 Posts
Microsoft
Re: SQL sub statement in a aspx file for c# in visual studio 13
Dec 25, 2015 07:35 AM|Fei Han - MSFT|LINK
Hi stenmananders,
Firstly, could you show us some your original data and the output you want? Which will help us understand your requirement.
Secondly, you could refer to this thread that discussed how to count columns and get summary data.
http://stackoverflow.com/questions/7913544/alternative-to-the-rollup
Best Regards,
Fei Han
Member
15 Points
19 Posts
Re: SQL sub statement in a aspx file for c# in visual studio 13
Jan 05, 2016 11:37 AM|stenmananders|LINK
Hi Fei Han,
The out put should display the amount of times the player are listed in a column, as well display a total of amounts in Col A Col B
Wins Loss
Player 1 Player 2
Player 1 Player 2
Player 1 Player 3
Player 2 Player 1
Player 3 Player 1
That should give output:
Name Wins Losses Total
Player1 3 2 5
Player2 1 3 4
Player3 1 1 2
Thanks in advance for your help.
None
0 Points
1 Post
Re: SQL sub statement in a aspx file for c# in visual studio 13
Jan 13, 2016 02:18 PM|Abogados Madrid|LINK
Nice solution man!!! i needed to find a way to make this on my website and thanks to asp.net i can do it, seriously im very happy about it, nice updates, im waiting for the next bro!! a hug and goodbye to all ;) this is my website and this is how i did it thanks to all your help guys!! thank u again Abogados Madrid