Quantcast
Channel: MySQL Forums - MySQL Workbench
Viewing all articles
Browse latest Browse all 3724

How to get results from multple queries into one table in MySQL stored procedure (2 replies)

$
0
0
I have the queries below in one stored procedure and want to put the results of those queries into one tmp table. How do I do that?

Here is some of my MySQL Select queries. These queries are originally pretty long so I scaled them down considerably:

CREATE DEFINER=`server`@`%` PROCEDURE `GetMonthlyRate`()
BEGIN

SELECT HA.ActualWeight, HA.ServiceDate
FROM Hauler HA
Left Join CoreContentType CCT ON OH.CoreContentTypeID =
CCT.CoreContentTypeID
WHERE HA.RecordDisabled = 0 AND
CCT.CoreContentTypeCategoryID = 1;




SELECT OH.ActualWeight, OH.IsRecycleContaminated,
OH.RecycleContaminationPercent, OH.RecycleRebatePercent,
OH.CoreContentTypeID, OH.ServiceDate
FROM OperationsHaul OH
Left Join CoreContentType CCT ON OH.CoreContentTypeID =
CCT.CoreContentTypeID
WHERE OH.RecordDisabled = 0 AND
CCT.CoreContentTypeCategoryID = 1;



SELECT OP.ActualWeight, OP.IsRecycleContaminated,
OH.RecycleContaminationPercent,
FROM Operations OP
Left Join CoreContentType CCT ON OH.CoreContentTypeID =
CCT.CoreContentTypeID
WHERE OP.RecordDisabled = 1 AND
CCT.CoreContentTypeCategoryID = 1;

END

Would this be a CREATE TABLE/INSERT??

Viewing all articles
Browse latest Browse all 3724

Trending Articles