9月
select * from pro_ioput
where  modtime between '2004-09-00' and '2004-09-30'8月
select * from pro_ioput
where  modtime between '2004-08-00' and '2004-08-31'

解决方案 »

  1.   

    select pername, sum(basemoney) as '八月份工资' from pro_ioput where modtimebetween '2004-08-01' and '2004-08-31' group by pername
      

  2.   


    pername basemoney modtime 
    陈家平   100      2004-09-21
    林爱铃   200      2004-09-22
    林名     200      2004-08-21
    林明     150      2004-07-05你的记录每条是什么意思??是每个人每天的工资,还是月工资?
    也就是说这些记录是怎么产生的?
      

  3.   

    select 工资年月=convert(char(7),modtime,120),工资=sum(basemoney)
    from pro_ioput
    group by convert(char(7),modtime,120)
      

  4.   

    是我将的不清楚,我要的是根据动态变化的月份得到上一个月的工资,比如现在是十月,我要得到九月的工资。basemoney就当成月份的总工资好了。
    当然如果有更好的方法,欢迎你的慷慨!
      

  5.   

    modtime什么意思?是调薪日期吗?,如果是:9月:
    select * from pro_ioput a
    where modtime=(select max(modtime) from pro_ioput where name=a.name and modtime<'2004-10-1')8月:
    select * from pro_ioput a
    where modtime=(select max(modtime) from pro_ioput where name=a.name and modtime<'2004-9-1')解释清楚些,要不不同人有不同理解
      

  6.   

    --那就是这个意思吧? 这条查询语句,查询的是系统日期的上一个月的工资数据select * from pro_ioput 
    where datediff(month,modtime,getdate())=1
      

  7.   

    --August
    select * from pro_ioput where year(modtime)=2004 and month(modtime)=8
    --September
    select * from pro_ioput where year(modtime)=2004 and month(modtime)=9
      

  8.   

    谢谢各位,
    select * from pro_ioput 
    where datediff(month,modtime,getdate())=1
    是我想要的结果,谢谢大家!