1.数据表Personinfo
  Code 文本(6) 工号
  Name 文本(10)姓名
  Sal_type 文本(10) 薪资类别--(月薪和时新之分)
  ......2.数据表AttendInfo
  YYMM 文本(6)会计年月
  Code 文本(6)工号
  BasePay 数字(6,2)底薪
  WorkTime 数字(6,2)工时----(都折算成小时数了)
  ......在ADOQuery中,如何写分别计算月薪和时新的工资SQL语句?
当月薪时,工资=BasePay/26/8 * WorkTime
当时新时,工资=Base * WorkTime

解决方案 »

  1.   

    SQL语句为:--月薪
    select a.name,b.basepay/26/8*worktime 月薪 from personinfo a,AttendInfo b where a.code=b.code
    --时薪
    select a.name,b.basepay*worktime 时薪 from personinfo a,AttendInfo b where a.code=b.code
    大量电脑书籍下载:
    http://www.netyi.net/in.asp?id=ForMoreU
      

  2.   

    不对吧
    这样两条SQL语句防在ADOQuery中,会是什么结果啊?
    要求能在一条SQL语句中,作出这种计算判断来?
      

  3.   

    select a.name,b.basepay/26/8*worktime 月薪 from personinfo a,AttendInfo b where a.code=b.code and Sal_type='月薪'
    union all
    select a.name,b.basepay*worktime 时薪 from personinfo a,AttendInfo b where a.code=b.code
    and Sal_type='时薪'
      

  4.   

    To:ghy412(用心良苦)   你的语法是SQL Server,在Access中似乎行不通,能帮手调试一下吗?
      

  5.   

    偶式过,在ACCESS中也可以的!!
      

  6.   

    你是不是要这个结果:
    select a.Code,b.Name,iif(a.Sal_type='月薪',b.BasePay/26/8*b.WorkTime,b.BasePay*b.WorkTime) as 工资
    from Personinfo a, AttendInfo b where a.Code=b.Code