问题描述
我的学生表具有这些列名称
学生代码,stud_act_id,费用,折扣率
A 52165 200 60
A 54902 300 50
A 54167 100 30
B 54165 60
B 54167 30
B 54902 50
我想查询以显示类似的值:
这里的折扣费"值取自学生代码"费和折扣率".
折扣费:(200-(60+(60 * 10)/100)).
折扣费:(300-(50+(50 * 10)/100)).
折扣费:(100-(30+(30 * 10)/100)).
折扣费用值将采用折扣率和费用A的学生代码形式,并将结果附加到学生代码B
输出结果应如下所示:
学生代码,stud_act_id,费用,折扣率
A 52165 200 60
A 54902 300 50
A 54167 100 30
B(折扣费:134)52165 60
B(折扣费:245)54902 50
B(折扣费:67)54167 30
请给我解决方法...
谢谢,
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 ...
Thanks,
推荐答案
Select fee - (discount_rate * 1.1), stud_act_id, discount rate from B
这会给你
which will give you
134 52165 60
245 54902 50
67 54167 30
如果您确实还需要其他桌子上的东西,那么可以使用
If you really also need the stuff from the other table then you can get away with
Select * from A
我猜想a)这不是您要追求的东西,b)这是家庭作业-因此您可能需要a)提供更清晰的信息,b)至少自己尝试一些事情并寻求帮助,而而不只是要求某人为您做
I''m guessing that a) this isn''t what you''re after and b) this is homework - so you probably need to a) give clearer information and b) at least try something yourself and ask for help, rather than just asking someone to do it for you
这篇关于需要查询帮助紧急........的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!