Problem statement:
• Alphabetically arranged list of waiters indicating their name, surname, ID and the person in charge.
• Alphabetically arranged list of participating chefs indicating their name, surname, ID card and the specialty they have.
I have the procedure well, without failures. The fact is that when making the union to show all the results, the value cookers.speciality is shown in charge as you can see in the image. Is there any way to show another column for cocineros.especialidad? I hope you have understood me, I enclose a picture of what I want to do and the script.
drop procedure if exists proc2;
DELIMITER //
create procedure proc2()
begin
select empleados.nombre, empleados.apellido, empleados.dni, camareros.encargado from empleados, camareros
where empleados.codemple=camareros.codemple group by empleados.nombre
union
select empleados.nombre, empleados.apellido, empleados.dni, cocineros.especialidad from empleados, cocineros
where empleados.codemple=cocineros.codemple group by empleados.nombre;
end //
DELIMITER ;
call proc2();