JSFiddle - React, Tailwind, and code Playground
by tsdexter
JavaScript
INSERT INTO printbio ( bioid,bio,datecreated,status,bioyear )
SELECT t.bioid,t.bio,getdate(),'Not Sent','2012'
FROM printbioedits t
where status = 3
and bioid in (
SELECT b.BioId
FROM biographies b
FULL OUTER JOIN UserMaster u ON b.modifiedby = u.userid
WHERE (b.editstatus = 2 OR b.editstatus = 3 OR b.editstatus = 4)
--AND (b.Deceased <> 1 OR b.status <> 2)
AND (b.status <> 2 AND b.status <> 3)
AND ((b.Deceased <> 0 AND b.status <> 2 AND b.status <> 3) OR (b.status <> 2 AND b.status <> 3) OR (b.deceased <> 1))
)
--
update Biographies
set editstatus = NULL,
AsIs = NULL,
NewBio = 0
where
bioid in (
SELECT b.BioId
FROM biographies b
FULL OUTER JOIN UserMaster u ON b.modifiedby = u.userid
WHERE (b.editstatus = 2 OR b.editstatus = 3 OR b.editstatus = 4)
--AND (b.Deceased <> 1 OR b.status <> 2)
AND (b.status <> 2 AND b.status <> 3)
AND ((b.Deceased <> 0 AND b.status <> 2 AND b.status <> 3) OR (b.status <> 2 AND b.status <> 3) OR (b.deceased <> 1))
)
UPDATE
Biographies
SET
Biographies.editstatus = ifotn_status_backups.editstatus
FROM
Biographies
INNER JOIN
ifotn_status_backups
ON
Biographies.BIOId = ifotn_status_backups.bioid