简体   繁体   中英

mysql: how to use the result of a stored procedure as a table/view in another stored procedure

i have a table - Adjustments - that looks like

id | employee_id | amount | earning/deduction

I need to query this table to get the total earnings and another query to get the total deductions. the two queries will need a parameter - id.

i then need to create a 3rd query that will use the resulting table of those 2 queries. this 3rd query will also need the same parameter - id.

is it possible to call the 3rd query, passing the parameter - id, which will also be used by the 1st and 2nd queries.

Thank you.

The first two can be done in one query. I'm betting it's possible all three can be don in one. But the answer is yes .

If you need more info, you have to give more info. Like all 3 queries.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM