Re: How do I export a set of data nightly

2004-11-02 Thread Matthew Scales
$ mysql -u mysqlusername -e 'insert your sql here' On Mon, 1 Nov 2004, 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,

How do I export a set of data nightly

2004-11-01 Thread Scott Haneda
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,

Re: How do I export a set of data nightly

2004-11-01 Thread ian douglas
There are lots of ways to do it. My personal favorite is to write it in Perl with the DBI library and tell cron to run that Perl script ... your Perl script could then write the data in any format you see fit, even send it somewhere else using Net::FTP or whatever. Just my $0.02... -id Scott

Re: How do I export a set of data nightly

2004-11-01 Thread Spenser
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

Re: How do I export a set of data nightly

2004-11-01 Thread Daniel Kasak
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'),

Re: How do I export a set of data nightly

2004-11-01 Thread Daniel Kasak
Daniel Kasak wrote: Write your script with the following line at the top: tee /path/to/output/file.sql Actually thinking about this more, you can probably skip this bit and just direct your output from the command called by cron, as per Spenser's example. ie: mysql -u username -ppassword