在mysql中要做一个自动按天查数据的 要查询前一天新增的数据 我设了个变量fn1和fn2为日期变量 但fn1和fn2统计出来的为 2008-05-01 2008-05-02 短日期类型 如下
#/bin/bash
fn1=`date -d yesterday +%Y-%m-%d`
fn2=`date -d yesterday +%Y-%m-%d`/bin/mysql -uusername -P6670 -h16.23.478.81 -ppassword -e'select * from SF_Word.wordattr where addtime between '$fn1' and '$fn2'' >/home/liyang01/word_$fn1.log实际SF_Word.wordattr表中的addtime为 ‘2001-09-19 00:00:00'长日期类型的 所以总查不出结果 请问日期变量如何设置才可以正常查询
#/bin/bash
fn1=`date -d yesterday +%Y-%m-%d`
fn2=`date -d yesterday +%Y-%m-%d`/bin/mysql -uusername -P6670 -h16.23.478.81 -ppassword -e'select * from SF_Word.wordattr where addtime between '$fn1' and '$fn2'' >/home/liyang01/word_$fn1.log实际SF_Word.wordattr表中的addtime为 ‘2001-09-19 00:00:00'长日期类型的 所以总查不出结果 请问日期变量如何设置才可以正常查询
http://edmundyau123.free-web-hosting.biz
fuck you
http://edmundyau123.free-web-hosting.biz
fuck you
http://edmundyau123.free-web-hosting.biz
fuck you
http://edmundyau123.free-web-hosting.biz
fuck you
http://edmundyau123.free-web-hosting.biz
fuck you
http://edmundyau123.free-web-hosting.biz
#/bin/bash
fn1=`date -d yesterday +%Y-%m-%d`
fn2=`date +%Y-%m-%d`/bin/mysql -uusername -P6670 -h16.23.478.81 -ppassword -e'select * from SF_Word.wordattr where addtime between '$fn1' and '$fn2'' >/home/liyang01/word_$fn1.log
fn1为前一天
fn2为当天