Hi,
Anyone can help on how to mysqldump using where clause with date range, i have sql statement but it will not generated an output needed like in "with data :".
table definition : testtab1
field definition :
| uploaded_date | timestamp | NO | | CURRENT_TIMESTAMP
with data :
+---------------------+
| uploaded_date |
+---------------------+
| 2017-05-05 03:00:15 |
| 2017-05-05 03:00:24 |
| 2017-05-05 03:00:29 |
| 2017-05-05 03:00:33 |
| 2017-05-05 03:00:34 |
| 2017-05-05 03:00:38 |
| 2017-05-05 03:00:43 |
| 2017-05-05 03:00:44 |
| 2017-05-05 03:00:46 |
| 2017-05-05 03:00:50 |
| 2017-05-05 03:01:03 |
| 2017-05-05 03:01:03 |
+---------------------+
SQL Statement :
First test : not generating output like "with data :"
# fnow=$(date +"%Y-%m-%d 00:00:00")
# tnow=$(date +"%Y-%m-%d 23:59:59")
# mysqldump -uuatusr01 -puatusr@01 -t -c -n --where="(uploaded_date>='$fnow' and uploaded_date<='$tnow')" uatdb testtab1 > output.sql
Second test : not generating output like "with data :"
# mysqldump -uuatusr01 -puatusr@01 -t -c -n --where="date_format(uploaded_date,'%Y%m%d')=date_for mat(now(),'%Y%m%d')" uatdb testtab1 > output.sql
Thanks in advanced.
Regards
Fpalero
Anyone can help on how to mysqldump using where clause with date range, i have sql statement but it will not generated an output needed like in "with data :".
table definition : testtab1
field definition :
| uploaded_date | timestamp | NO | | CURRENT_TIMESTAMP
with data :
+---------------------+
| uploaded_date |
+---------------------+
| 2017-05-05 03:00:15 |
| 2017-05-05 03:00:24 |
| 2017-05-05 03:00:29 |
| 2017-05-05 03:00:33 |
| 2017-05-05 03:00:34 |
| 2017-05-05 03:00:38 |
| 2017-05-05 03:00:43 |
| 2017-05-05 03:00:44 |
| 2017-05-05 03:00:46 |
| 2017-05-05 03:00:50 |
| 2017-05-05 03:01:03 |
| 2017-05-05 03:01:03 |
+---------------------+
SQL Statement :
First test : not generating output like "with data :"
# fnow=$(date +"%Y-%m-%d 00:00:00")
# tnow=$(date +"%Y-%m-%d 23:59:59")
# mysqldump -uuatusr01 -puatusr@01 -t -c -n --where="(uploaded_date>='$fnow' and uploaded_date<='$tnow')" uatdb testtab1 > output.sql
Second test : not generating output like "with data :"
# mysqldump -uuatusr01 -puatusr@01 -t -c -n --where="date_format(uploaded_date,'%Y%m%d')=date_for mat(now(),'%Y%m%d')" uatdb testtab1 > output.sql
Thanks in advanced.
Regards
Fpalero