specific records using procedure in mysql without using the static values in the table -


 create table company(id int, name varchar(20), designation varchar(20), parent int);   insert company values(1,'shyam', 'vp', null);   insert company values(2,’sundar’, 'gm', 1);   insert company values(3,'rajan', 'm', 2);   insert company values(4,'karthik', 'lead', 3);   insert company values(5,'raj', 'developer',4);   insert company values(6,'sami', 'developer', 4);   insert company values(7,'diva', 'lead', 3);   insert company values(8,'dina', 'developer', 7);   insert company values(9,'mahe','developer', 7); ` 

the table created. there 2 teams in table. both under gm , m, each team contains lead , 2 developers.

now, need create procedure parameter. when give input on calling id, need entire team gm, m, lead , 2 developers.

for example:

if giving input 8, need select sundar, rajan, diva, dina, mahe table.

if giving input 6, enter code here need select sundar, rajan, karthik, raj , sami.

please without using values in table.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -