varsha dodiya

varsha dodiya

  • NA
  • 407
  • 75.2k

sql group by clause

Aug 22 2014 2:55 AM
totalvat rsdiscount %
50052
100022
1200105

i want my result to be calculated as 

(500+5) * 2/100 =a
(1000+2)*2/100=b
(1200+10)*5/100=c
" " " " " 
""""""
""

and result = SUM(a+B+C) rs.

this is what i tried

cmd = new SqlCommand("Select (SUM(P_ttotal)+SUM(P_vatto)* (P_totdis)/100) as dis  from PRO_BILL", conn);

but it is throwing exception P_totdis is not in group by clause....
 help me in this.
any help will be appreciated 


Answers (3)