You could write a bash script like this:

#!/bin/bash

mysql -u username -ppassword --exec="SELECT...;" > textfile.txt


There's no space after -p and before the password.  This will export the
results to a simple text file.  It might not be in format you want
though.  But, it gives you an idea of how to pull this off.


On Mon, 2004-11-01 at 19:27, Scott Haneda wrote:
> My query works:
> (version 4)
> 
> SELECT u.id, r.user_id,
>        u.first_name, u.middle_name, u.last_name,
>        u.company, u.department, u.address, u.address2,
>        u.city, u.state, u.country, u.zip,
>        u.phone, u.fax, u.email,
>        DATE_FORMAT(u.updated, '%m/%d/%Y'), DATE_FORMAT(u.added, '%m/%d/%Y'),
>        r.serial, r.product, DATE_FORMAT(r.added, '%m/%d/%Y')
> FROM user as u 
> INNER JOIN registered_serials as r
> WHERE u.id = r.user_id LIMIT 10
> 
> However, I need to run this once a day on schedule via cron, but I am not
> sure how to feed this statement into mysql from bash, can someone point me
> to the correct way?
> 
> -- 
> -------------------------------------------------------------
> Scott Haneda                                Tel: 415.898.2602
> <http://www.newgeo.com>                     Fax: 313.557.5052
> <[EMAIL PROTECTED]>                          Novato, CA U.S.A.
> 
> 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to