to_date函数用法示例

to_date函数用法示例


select * from tom_users where fvisitdate<to_date(’2004-6-18′,’yyyy-mm-dd’) and fvisitdate>to_date(’2004-6-17′,’yyyy-mm-dd’)

to_date 这样子转换只能转到2004-6-17 0:0:0

如果要查17号的访问情况,那么,就要用<18号的就可以了。

 select distinct a.fgroupid,a.fname from tom_groups a,tom_users b  where a.fparentid=0 and a.fgroupid=b.fgroupid  and (b.fvisitdate is not null and b.fvisitdate >= to_date(’2004-06-17′,’yyyy-mm-dd’) ) and (b.fvisitdate is not null and b.fvisitdate <= (1+to_date(’2004-06-17′,’yyyy-mm-dd’)));

相关帖子:
  • No Related Posts
  • micas Jun 26th 2007 04:16 pm SQL No Comments yet Trackback URI Comments RSS

    Leave a Reply

    You must be logged in to post a comment.