To run a query with multiple statements, ensure that each statement is separated by a semicolon; then set the DSQEC_RUN_MQ global variable to 1 and run the query. When the variable is set to zero, all statements after the first semicolon are ignored.
You can just run multiple SQL statements one after the other in a stored procedure.
A simple SELECT statement is the most basic way to query multiple tables. You can call more than one table in the FROM clause to combine results from multiple tables.
Say I wanted to do UPDATE table SET name = 'bob'
and UPDATE table SET age = 55 WHERE name = 'jim'
how do I do them in the same mysql_query()?
EDIT: Since this question has a fair amount of views I'd like to point out that as of PHP 5.5 mysql_query
and other mysql_*
functions are now deprecated and shouldn't be used.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With