表中 有 多个个字段 其中一个字段是 文件全路径   FilePath   内容是 类似于 ‘G:\delphi工程\每日备份\最新\备份.txt’
另一个是  LastTime  内容类似于 ‘2008/09/17 23:19:20’请问如和组织sQL 语句查询文件类型是 .txt  时间是2008 年的所有记录呢?请高人指点! 

解决方案 »

  1.   

    datepart(year,LastTime )=2008 and right(FilePath,3)='txt'
      

  2.   

     select * from tb where charindex('.txt',FilePath)>0 and  datepart (yy,LastTime)=2008
      

  3.   


    where year(LastTime)=2008 and right(FilePath,3)='txt'
      

  4.   


    select * from tb where right(FilePath,4)='.txt' and year(LastTime)=2008
      

  5.   

    or select * from tb where right(FilePath,4)='.txt' and year(LastTime)=2008
      

  6.   

    我用的是 Sqlite3 数据库!好像这些函数都不支持啊!还有别的通用的方法吗 
      

  7.   

     FilePath like '%.text%' and LastTime like '%2008%'