MySQL Forums
Forum List  »  MySQL Workbench

Re: How to get results from multple queries into one table in MySQL stored procedure
Posted by: Marcus Dardy
Date: May 10, 2018 12:21PM

So would that look like this:

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

Create Temporary Table tmp (...) NOT SURE WHAT GOES IN PARENTHESES

insert into tmp

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;


insert into tmp

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;

insert into tmp

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

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: How to get results from multple queries into one table in MySQL stored procedure
335
May 10, 2018 12:21PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.