Created
April 7, 2017 20:05
-
-
Save primogf/4cffc3fa8b5f16dadfadfe72f46304f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
update Document set stat = 0 where id_documento in ( | |
select id_documento from ( | |
select | |
d.id_documento | |
from | |
DocumentOrigin o | |
inner join Document d on d.id_documento = o.id_documento | |
where | |
o.id_registro in( | |
SELECT | |
o.id_registro | |
FROM | |
Document d | |
INNER JOIN | |
DocumentOrigin o ON o.id_documento = d.id_documento | |
WHERE | |
d.stat <> 0 and id_registro > 128263 | |
group by o.id_registro | |
having Count(*) > 1 | |
) and d.caminho_file is null) as view | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment