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"
精彩评论