解决方案 »

  1.   

    你直接通过日期 在 查询语句中 Select *  from tb_remind where 日期 between ..... and .... 来过滤阿
      

  2.   

    尽量减少和数据库的交互!
    根据你上面的情况,你完全可以写一个存储过程的嘛!
    比如
    create Procedure P_SelectSomthings
    as
    begin
    declare @count int
    Select @count=count(1) from tb_remind
    if(@count>0)
    begin
          declare @days int
          Select top 1 @days=Days from tb_remind
          select PlanTitle,format(ExecuteTime,'yyyy-mm-dd') as ExecuteTime,PlanContent from tb_planreminder where right(convert(varchar(8),ExecuteTime,112),4) between  and '0919'
    end
    end
      

  3.   

    create Procedure P_SelectSomthings
     as
     begin
     declare @count int
     Select @count=count(1) from tb_remind
     if(@count>0)
     begin
           declare @days int
           Select top 1 @days=Days from tb_remind
           select PlanTitle,format(ExecuteTime,'yyyy-mm-dd') as ExecuteTime,PlanContent from tb_planreminder where right(convert(varchar(8),ExecuteTime,112),4) between  and '0919'
     end
     end 
      

  4.   

    create Procedure P_SelectSomthings
     as
     begin
     declare @count int
     Select @count=count(1) from tb_remind
     if(@count>0)
     begin
           declare @days int
           Select top 1 @days=Days from tb_remind
           select PlanTitle,format(ExecuteTime,'yyyy-mm-dd') as ExecuteTime,PlanContent from tb_planreminder where right(convert(varchar(8),ExecuteTime,112),4) between  and right(convert(varchar(8),DATEADD(day,@days,getdate()),112),4)
     end
     end