[code=mysql]
create procedure view_select
(coll int(11))
begin
declare x int;
declare y int;
set x=0;
select count(*) into y from s_details where college_code=co ll;
while(x<y) do
select day_number,titl e,first_name,mi ddle_name,last_ name,
date_of_birth,e _mail,ref_numbe r,
date_of_entry_o f_details,cours e_id,x+1 from s_details;
set x=x+1;
end while;
end//
[/code]
How to increment the value of x alone for each record being displayed?
In this the select statement is repeated as many times as x?
How to solve this problem?
create procedure view_select
(coll int(11))
begin
declare x int;
declare y int;
set x=0;
select count(*) into y from s_details where college_code=co ll;
while(x<y) do
select day_number,titl e,first_name,mi ddle_name,last_ name,
date_of_birth,e _mail,ref_numbe r,
date_of_entry_o f_details,cours e_id,x+1 from s_details;
set x=x+1;
end while;
end//
[/code]
How to increment the value of x alone for each record being displayed?
In this the select statement is repeated as many times as x?
How to solve this problem?
Comment