Page 1 of 1

2 queries in one stored procedure

Posted: Sat Jun 28, 2008 4:18 am
by ddragas
one more question

how can 2 or more queries be executed in one stored procedure.
This example works, but returns results only from first query

Code: Select all

 
BEGIN
DECLARE lastPayment DOUBLE ;
 
select payments.payment
from payments 
where client =  clijentSearch
order by id desc limit 1;
 
set lastPayment = payment;
 
select (lastPayment - (sum(table1.quantity * table1.price))) as cashBalance 
    from table1
    where table1.client = clijentSearch; 
 
END