forked from SimplesIP/pabx-app
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.4 KiB
43 lines
1.4 KiB
2 years ago
|
select uf, mun_nome from pbx_municipio_classifica a, pbx_municipio_prefixo b where b.mun_id = a.mun_id and prx_prefixo = '653614'
|
||
|
|
||
|
select * from pbx_municipio_prefixo where mun_id = 13400
|
||
|
|
||
|
insert into pbx_municipio_prefixo values(13400, '659289')
|
||
|
|
||
|
select * from pbx_municipio_classifica where uf = 'MT' and mun_nome ilike '%CU%'
|
||
|
select * from pbx_consulta_ddd limit 1
|
||
|
select * from pbx_municipios
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
select distinct (select mun_id from pbx_municipio_classifica where uf = a.uf and mun_nome = a.nome_municipio and mun_ddd = a.codigo_ddd) as id,
|
||
|
a.uf,
|
||
|
a.nome_municipio,
|
||
|
a.prefixo
|
||
|
from pbx_consulta_ddd a
|
||
|
where exists(select '' from pbx_municipio_classifica where uf = a.uf and mun_nome = a.nome_municipio and mun_ddd = a.codigo_ddd)
|
||
|
|
||
|
|
||
|
|
||
|
delete from pbx_municipio_classifica
|
||
|
|
||
|
--importa pbx_consulta_ddd
|
||
|
insert into pbx_consulta_ddd
|
||
|
select id, codigo_ddd, nome_municipio, uf, prefixo from pbx_municipios
|
||
|
|
||
|
--importa pbx_municipio_classifica
|
||
|
insert into pbx_municipio_classifica(uf, mun_nome, mun_ddd)
|
||
|
select distinct uf, nome_municipio, codigo_ddd from pbx_municipios
|
||
|
|
||
|
--importa prefixo
|
||
|
insert into pbx_municipio_prefixo
|
||
|
select distinct (select mun_id from pbx_municipio_classifica where uf = a.uf and mun_nome = a.nome_municipio and mun_ddd = a.codigo_ddd) as id,
|
||
|
a.prefixo
|
||
|
from pbx_consulta_ddd a
|
||
|
where exists(select '' from pbx_municipio_classifica where uf = a.uf and mun_nome = a.nome_municipio and mun_ddd = a.codigo_ddd)
|
||
|
|
||
|
|
||
|
|