I am working on stored proceudes in mysql.
I found that for some of proc i have to write a same portion of sql query, But i need a way to reuse the same query code(not result) in all proc, How i can do that?
Here is my S.proc:
BEGIN
SELECT date, sum(size_kg) as `total_size`, sum(net_size) as `total_net_size`,sum(bags) as `total_bags` FROM `stock` WHERE date=CURDATE() GROUP By CURDATE();
END
The code before where clause will be same in all proc, So How i can reuse that query portion code (Not result) ?