请求sql一计算问题,basic*norm*pwd-deduct=salary,但是pwd是从别的表中调过来(20分)

  • 主题发起人 主题发起人 shimingxing
  • 开始时间 开始时间
S

shimingxing

Unregistered / Unconfirmed
GUEST, unregistred user!
---------------------------------------------------- -----------------------
ID | basic | norm | deduct pwd | salary ID | pwd
---------------------------------------------------- ----------------------
1 | 12 | 1.2 | 5 | | 1 | 20
----------------------------------------------------- ----------------------
table1 table2

我想把table1中的ID相对应的pwd从table2中调出来放到table1的pwd下,然后计算
basic*norm*pwd-deduct=salary 把计算的结果给salary,并将所有的数据显示在cxgrid
中,我有的sql语句为可是不行,帮我看看吧,谢谢!我的sql语句为:
select t2.pwd,(t2.pwd*t1.basic*t1.norm-t1.deduct) as t1.salary, t1.* from table1 t1,table2 t2 where t1.ID=t2.ID 其中;(t2.pwd*t1.basic*t1.norm-t1.deduct) as t1.salary不对,请问该怎么写呢?感谢
 
Select t1.ID, t1.basic, t1.norm, t1.deduct, t2.pwd
,(basic * norm * t2.pwd - deduct) as salary
from table1 as t1,table2 as t2
WHERE t1.ID = t2.ID
这样就ok了...
 
我自己也写出来了,和你的差不多,谢谢啊
 
后退
顶部