Skip to content

Instantly share code, notes, and snippets.

@hgmiguel
Created May 22, 2014 14:26
Show Gist options
  • Select an option

  • Save hgmiguel/9d014902678db5e351a9 to your computer and use it in GitHub Desktop.

Select an option

Save hgmiguel/9d014902678db5e351a9 to your computer and use it in GitHub Desktop.
beautifull sql
with temp as (select d_codigo
from (select d_codigo,d_estado, length(d_codigo)
from colonia_tmp
group by d_codigo,d_estado
having length(d_codigo) = 4) newcode)
update colonia_tmp set d_codigo= '0' || d_codigo where d_codigo in (select d_codigo from temp);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment