On 23-Jun-2003 Hubbard, Dan wrote:
> Passing mysql commands through mysqldump or BACKUP TABLE ?
>
> We would like to perform backups on selective data within selective
> tables
> and then purge the matching data in those tables. Is it possible to pass
> mysql commands through either util above ? Which is better ?
>
> Example: sql statement...
>
> select * from tablename1 WHERE ((date_time > '2003-00-00 00:00:00') and
> (date_time < '2003-06-31 00:00:00'));
>
> TIA !
(June has 31 days ?)
---
#!/bin/sh
INPERIOD="BETWEEN '2003-01-01 00:00:00' AND '2003-06-30 23:59:59'"
OPT="-e -q -t"
mysqldump $OPT --where="date_time $INPERIOD" db tbl > tbl.dmp && \
mysql -e "DELETE FROM tbl WHERE date_time $INPERIOD" db
Regards,
--
Don Read [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.
(53kr33t w0rdz: sql table query)
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]