需要查询帮助紧急........ [英] Need Query Help urgent please........

查看:42
本文介绍了需要查询帮助紧急........的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我的学生表具有这些列名称
学生代码,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,

推荐答案

首先,x +(x * 10)/100 = x * 1.1-学徒式的我很确定,但是更容易阅读恕我直言

您的输出实际上没有任何意义,因为您在列中包含了不同的值(A中的一个值,B中的另一个值)-一组包含4列,其他仅3列...

A和B是表名吗?您有学生代码的标题,但每个组中的ID之间都有一个匹配项.

我对您追求的最好的猜测是:

Firstly, x + (x * 10)/100 = x * 1.1 - pedantic I''m sure, but easier to read IMHO

Your output doesn''t really makes any sense, as you are including different values (one lot from A and the other from B) in the columns - and one set includes 4 columns, the other just 3 columns...

Are A and B the table names? you have a heading of Student Code, but there is a match between the Ids in each group.

My best guess at what you are after is:

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


这篇关于需要查询帮助紧急........的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆