Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

BORRADORR

select sum(SupervisorID)
from tblsupervisores
GROUP BY SupervisorID;

select supervisorID, concat(left(SupervisorID, 2),


(supervisorID + (select sum(SupervisorID) from
tblsupervisores)),right(SupervisorID,1)) as NuevoCI
from tblsupervisores

UPDATE tblsupervisores
SET NuevoCI = CONCAT(
LEFT(supervisorID, 2),
(supervisorID + (SELECT SUM(supervisorID) FROM tblsupervisores)),
RIGHT(supervisorID, 1)
);
update tblsupervisores
set supervisorID, concat(left(SupervisorID, 2),
(supervisorID + (select sum(SupervisorID) from
tblsupervisores)),right(SupervisorID,1)) as NuevoCI
from tblsupervisores;
-------------------------------------------------------------------
use bdproblema07;
CREATE TABLE tblsupervisores (
SupervisorID INT PRIMARY KEY,
CI VARCHAR(20),
nombre VARCHAR(100)
);
INSERT INTO tblsupervisores (SupervisorID)
SELECT DISTINCT idSupervisor
FROM tbldenuncias
ORDER BY idSupervisor;

select * from tblsupervisores;

--ID SUPERVISORES
update tblsupervisores
set ci = concat(left(SupervisorID, 2),
SupervisorID + (select sum(SupervisorID) from tblsupervisores),
right(SupervisorID, 1));

--NOMBRE:
update tblsupervisores
SET nombre = concat('Super', SupervisorID);

----------------------------------------
BORRADORR
select sum(SupervisorID)
from tblsupervisores
GROUP BY SupervisorID;

select supervisorID, concat(left(SupervisorID, 2),


(supervisorID + (select sum(SupervisorID) from
tblsupervisores)),right(SupervisorID,1)) as NuevoCI
from tblsupervisores

UPDATE tblsupervisores
SET NuevoCI = CONCAT(
LEFT(supervisorID, 2),
(supervisorID + (SELECT SUM(supervisorID) FROM tblsupervisores)),
RIGHT(supervisorID, 1)
);
update tblsupervisores
set supervisorID, concat(left(SupervisorID, 2),
(supervisorID + (select sum(SupervisorID) from
tblsupervisores)),right(SupervisorID,1)) as NuevoCI
from tblsupervisores;

select SupervisorID + (SELECT SUM(SupervisorID) FROM tblsupervisores)


'Suma del CI + Total' FROM tblsupervisores;

You might also like