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 2005 Forums
 Transact-SQL (2005)
 Need Query Help urgent

Author  Topic 

suresh0534
Starting Member

3 Posts

Posted - 2012-02-14 : 20:03:27
Hi,
I have table Student with these columns names
student_code , stud_act_id , fee , discount_rate
A 52165 200 60
A 54902 300 50
A 54167 100 30
B 54165 60
B 54167 30
B 54902 50

I want query to display the values like:
Here Discount Fee value takes from the student_code fee and discount_rate .
Discount Fee: (200-(60+(60*10)/100)).
Discount Fee: (300-(50+(50*10)/100)).
Discount Fee: (100-(30+(30*10)/100)).
The discount Fee value will taking form the student_code of A of discount_rate and fee and result append to the Student_code B
The out put should like this:

student_code , stud_act_id , fee , discount_rate
A 52165 200 60
A 54902 300 50
A 54167 100 30
B(Discount Fee:134) 52165 60
B(Discount Fee:245) 54902 50
B(Discount Fee:67) 54167 30

Please give me solution how to write the query...
Thanks,

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-02-14 : 20:45:08
Will you have another more than 1 student_code per stud_act_id ?

like Student_code C , D etc ? How would the expected result looks like ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -