开发者

MySql command line: execute two queries at once?

I am using the MySql command tool to query a database from inside a Ruby script I wrote. However the need has arisen for a query that creates a temporary table, then in another query I need to perform a join on the temporary table. The only problem is every time I 开发者_JS百科invoke mysql -h <host> -r <username> -D <database> -e "QUERY" I get a new transaction, so when I am trying to perform my join, the temporary table doesn't exist anymore.

Is there anyway to do execute two separate queries in one invocation of the mysql command line tool??

Something like: mysql -h <host> -r <username> -D <database> -e "QUERY1" -e "QUERY2"

Or is there some alternative way to store my queries? like in a text file or something?

Thanks


Wouldn't the ";" do the trick?

mysql -h <host> -r <username> -D <database> -e "QUERY1;QUERY2"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜