由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - Linux server, mysql
相关主题
请教一个query in mysqlsqldeveloper 问题
mysql 在两台电脑中倒数据? (转载)问个数据库问题
请问如何实现这样一个mysql的query, 谢谢mySQL怎么这么慢?
请问这个query怎么做a complex sql query, high hand help!!!
有用phpMyadmin的吗,请教how to query chinese in mysql?
请教怎么来log duration of a MYSQL procedure?What is optimizer statistics of a table and what is access plan of a query
sql面试题目求指点A question in class diagram
How to load data into Mysql from txt file?请教ACCESS问题, 如何把REPORT的结果(如SUM)写回TABLE中?
相关话题的讨论汇总
话题: mysql话题: echo话题: number话题: query话题: txt
进入Database版参与讨论
1 (共1页)
m******o
发帖数: 61
1
有一个file, 里面有好几个select query,这几个select query之间用 echo 隔开,文
件是这样的:
\! echo "Number of emails ";
\! echo "-------------------------------------------------------------------
v*****r
发帖数: 1119
2
I don't think you can invoke OS command inside mysql prompt. You can try:
1. Use tee to spool
mysql> tee all_tables.txt
Logging to file 'all_tables.txt'
mysql> show tables;
+--------------------------------+
| Tables_in_mypdc |
+--------------------------------+
| activemeasurement |
| calculatedmeasurement |
| calculatedmeasurementdetail |
| company |
| configurationentity |
| customactionadapter |
| customactionadapterdetail |
| custominputadapter |
| custominputadapterdetail |
| customoutputadapter |
| customoutputadapterdetail |
.......................
.......................
mysql> notee
2. Write a shell script to include multiple mysql command (one for each
query), something like this:
#!/bin/bash
...
# report header 1
echo "Number of emails "
mysql -t db < emails.sql >> output_report.txt
....
# report header 2
echo "Number of files "
mysql -t db < files.sql >> output_report.txt
....

【在 m******o 的大作中提到】
: 有一个file, 里面有好几个select query,这几个select query之间用 echo 隔开,文
: 件是这样的:
: \! echo "Number of emails ";
: \! echo "-------------------------------------------------------------------

m******o
发帖数: 61
3
Thanks for reply.
In the second method you mentioned, is there any way I can combine the
output with echo? - instead of the output file with the query result, I
also want the header you mentioned.
Thanks a lot!

try:

【在 v*****r 的大作中提到】
: I don't think you can invoke OS command inside mysql prompt. You can try:
: 1. Use tee to spool
: mysql> tee all_tables.txt
: Logging to file 'all_tables.txt'
: mysql> show tables;
: +--------------------------------+
: | Tables_in_mypdc |
: +--------------------------------+
: | activemeasurement |
: | calculatedmeasurement |

v*****r
发帖数: 1119
4
Same as re-directing and appending the output of mysql result:
echo "Heading ..." >> output_report.txt

【在 m******o 的大作中提到】
: Thanks for reply.
: In the second method you mentioned, is there any way I can combine the
: output with echo? - instead of the output file with the query result, I
: also want the header you mentioned.
: Thanks a lot!
:
: try:

m******o
发帖数: 61
5
great! Thanks!

【在 v*****r 的大作中提到】
: Same as re-directing and appending the output of mysql result:
: echo "Heading ..." >> output_report.txt

1 (共1页)
进入Database版参与讨论
相关主题
请教ACCESS问题, 如何把REPORT的结果(如SUM)写回TABLE中?有用phpMyadmin的吗,请教
SQL question...请教怎么来log duration of a MYSQL procedure?
如何完成这个sql?sql面试题目求指点
请教一个ACCESS的土问题How to load data into Mysql from txt file?
请教一个query in mysqlsqldeveloper 问题
mysql 在两台电脑中倒数据? (转载)问个数据库问题
请问如何实现这样一个mysql的query, 谢谢mySQL怎么这么慢?
请问这个query怎么做a complex sql query, high hand help!!!
相关话题的讨论汇总
话题: mysql话题: echo话题: number话题: query话题: txt