0

Looking for a way to Query data from MySQL database & write it to a output txt file. I am trying to query a Linux server db from a remote windows box.

MySQL Query:

mysql -u XXX -pXXX -h ttplxapp-esm01.abc.com -D telalert -e "select max(convert_tz(start_time,\"+00:00\",\"-04:00\")) AS Time,group_concat(username SEPARATOR \" \") AS Contact, message AS Message from sends where convert_tz(start_time,\"+00:00\",\"-4:00\") like \"$query_date%\" group by alert_id order by Time desc ;" 

A java script or script will be ideal.

fedorqui
  • 275,237
  • 103
  • 548
  • 598

1 Answers1

2

Try SELECT...FROM statement with INTO OUTFILE clause.

SELECT Syntax.

Devart
  • 119,203
  • 23
  • 166
  • 186
  • You can run a script or a statement using [MySQL command-line tool](http://dev.mysql.com/doc/refman/5.5/en/mysql.html). – Devart Jul 02 '12 at 06:21