Moustafa Khazaal
Moustafa Khazaal

Reputation: 33

Get multiple table output from Stored Procedure Mysql (Laravel + SPA)

I have a stored procedure that returns me three tables (3 Selected) in Laravel when a call the procedure

Public function getTables(Request $request){
  $output =DB::select('call all_result(?,?)', array($request->in1,$request->in2));
  return response()->json($output);
}

Result: return only first table, i need 3 tables together

Update:

Stored Procedure

DELIMITER $$
create procedure all_result()
BEGIN

select * from table1;
select * from table2;
select * from table3;

END
$$

Note:

I use SPA(Single Page Application)Vue Js frontend and i use Laravel backend

VueJs call API from Laravel Via Axios

My Database is MYSQL

Upvotes: 0

Views: 272

Answers (1)

VIKAS KATARIYA
VIKAS KATARIYA

Reputation: 6005

Write code in a stored procedure like this:

DELIMITER $$
CREATE PRECEDURE all_result()
BEGIN

SELECT * FROM table1;
SELECT * FROM table2;
SELECT * FROM table2;

END
$$

Upvotes: 1

Related Questions