How to get row number using sql stored procedure
<p>I have two tables. one is local and other one is foreign. so what I want to do is to give row numbers after joining two tables using stored procedure. 
First I want to get same number of column from two tables and after that I want combine as a one table and give row numbers.
below is my query.</p>

<pre>

set @row_number=0;

select (@row_number:=@row_number + 1) as number, 
(
select a.*
from 
(select ID,title,last_name,first_name
from local
)
a
union all
select b.*
from
(select ID,title ,last_name,first_name
from foreign
)
b
)
;

</pre>

<p>Could anyone please tell me what the wrong with it?</p>