Questions tagged [multi-query]

Used for running multiple database queries/statements. Such as, queries separated by a semi-colon ';' in SQL. Or running multiple queries via separate requests.

SQL Example:

SELECT * FROM table1;
SELECT * FROM table2;

PHP/mysqli example1:

mysqli_multi_query(
    "SELECT * FROM table1;
     SELECT * FROM table2;"
);

PHP/mysqli example2:
This isn't really good practice, compared to the previous example, but this tag would still be fitting for a question with this type of code.

   mysqli_query("SELECT * FROM table1");
   mysqli_query("SELECT * FROM table2");

However, for PHP/mysqli, you should use mysqli-multi-query

84 questions
0
votes
1 answer

XML malformed via MySQL multi-query

I need to use multiple queries and send them out as well formed xml for as3 purposes. When I use only one query everything works fine. Problem starts when multi-query operates. Right now when //XML header is hidden I get a structure printed on…
0
votes
1 answer

Why PHP Mysql multi_query() is slower than loop query()

I'm working on HHVM with MySQL. And I'm really confused to find out that batching 2000 sql queries using multi_query() is much slower than a 2000 loop with single query() (please see the code and the result at end). By further profiling, I found the…
naizheng TAN
  • 167
  • 1
  • 5
0
votes
2 answers

having trouble with getting rows back from msqli::multi_query

I've got an sql query that contains a number of statements. It: sets a user variable calls a stored procedure calls another stored procedure selects some data I know that the query is correct, because I've tested it in MySQL Workbench, under the…
Carson Myers
  • 37,678
  • 39
  • 126
  • 176
0
votes
3 answers

Executing Multiple or Three Queries at Once

I'm currently creating an online reservation system. How can I execute multiple queries at once? I'm already using mysqli_muti_query. I have three queries to execute.
0
votes
3 answers

JOIN across multi-query

If I have a multi-query like: SELECT * FROM my_database.`table` AS one WHERE one.some_field LIKE 'abc'; SELECT * FROM my_database.`table` AS two JOIN one ON one.id = two.relatedId; Yes. Those are the same tables, and they are…
Reed
  • 14,703
  • 8
  • 66
  • 110
0
votes
2 answers

select count of each user privileges and pages from 4 tables mysql

This might be easy but I don't have enough experience with mysql, I have four tables: employee user privilege page I want to select from these four tables the following: emoloyeeName UserId count(privilege) count(pages) so I want my query to…
Sal Saad
  • 45
  • 2
  • 12
0
votes
3 answers

How to use multi_query for insert and delete records of two tables

I want to insert two different records into two different tables and delete original one. like this $msgid = POST_['roll_id']; $query = "INSERT INTO del_subscription SELECT * from subscription WHERE mem_id='$msgid'"; $query1 = "INSERT INTO…
Fussionweb
  • 280
  • 5
  • 13
0
votes
1 answer

multi_query does not run within a loop

A multi-query that I've put into another query does not run. The stored procedures in the inner query were not executed. The multi query alone is running well, but inside the loop it does not. Cold you please check, why InnerQuery does not perform…
Peter
  • 1,224
  • 3
  • 16
  • 28
0
votes
1 answer

PHP Mssql multi query in a store procedure

I have an PHP script that execute a store procedure. So far so good. Now I have a store procedure that execute two queries within the store procedure: EXEC ('Delete From [DB].dbo.[Table]') EXEC ('INSERT INTO [DB].dbo.[Table] ([Col])VALUES(1)') If I…
Der_V
  • 177
  • 1
  • 16
0
votes
6 answers

SQL select id from a table to query again all at once

Given the following table: id message owner_id counter_party_id datetime_col 1 "message 1" 4 8 2014-04-01 03:58:33 2 "message 2" 4 12 2014-04-02 10:27:34 3 "message 3" 4 8 …
0
votes
1 answer

Error using multi_query "Call to a member function multi_query() on a non-object "

I'm looking for an explanation / fix for this error. I'm using the following script. This is my first time using multi_query : $storyidr=$_POST['storyidr']; $mysqli = mysqli_connect($dbhost,$dbusername,$dbpasswd,$database_name) or die…
rhill45
  • 559
  • 10
  • 35
0
votes
2 answers

Java - Mysql - Multiple query

String qLink = ""; qLink = "INSERT INTO trackgps.queclinklogs(Supplier,NtwProtocol,IMEI,log,DBTIME)" + "VALUES" + "(" …
ThelmaJay
  • 79
  • 1
  • 14
0
votes
1 answer

sqli multi-query combine two queries on a single one

I have a situation where I have a large table and Im making two queries and I want to combine them into a single one. Say I have a table like this: Name |LastName|Address|State --------------------------- John |Carter |23 Blv | CA Bill |Carter |23…
inrob
  • 4,969
  • 11
  • 38
  • 51
0
votes
1 answer

mysqli query only returns one row from each table

I have finally managed to get my code to return the first column from each one of two tables, but how do i change the code to return all the various column data from both tables and in order by an ID number. Here is my code
0
votes
1 answer

Mysqli multi query PHP

I want to use php mysqli function, to query this: SET @rownum = 0, @rank = 1, @prev_val = NULL; SELECT @rownum := @rownum + 1 AS row, @rank := IF(@prev_val!=score,@rownum,@rank) AS rank, userid, @prev_val := score AS score FROM ( …
user2770029
  • 722
  • 1
  • 7
  • 8