I am trying to create a MySQL PROCEDURE with multiple SELECT statements. In its current state, the PROCEDURE only returns the results from the first query, and not the second query.
The Code:
CREATE PROCEDURE `GETPRODUCT`( productid INT ) DETERMINISTIC READS SQL DATA
SELECT DISTINCT product.id, product.name, product.price FROM products WHERE products.id = productid;
SELECT DISTINCT a.id, a.date, a.pid, a.uid, a.review, b.username FROM reviews a JOIN users b ON a.uid = b.id WHERE a.pid = ? ORDER BY a.date DESC LIMIT 0, 11;
END$
CALL GETPRODUCT( 1 );
Bascially, the first query grabs the product information, and the second query is a JOIN query that grabs the reviews from the reviews table, and the user's name from the users table.
The PROCEDURE is successfully created, and I can successfully call the PROCEDURE, but only the results from the first PROCEDURE is returned. There is matching information in both tables. Is there any reason why this is not returning all of the information?