From: | Segurinfo Col <seg_softweb(at)hotmail(dot)com> |
---|---|
To: | <lzevallos(at)lobosistemas(dot)com>, <pgsql-es-ayuda(at)postgresql(dot)org> |
Subject: | RE: Problema con una consulta... |
Date: | 2009-05-13 01:40:09 |
Message-ID: | BLU133-W29082B12C8280E3D6E7B859F610@phx.gbl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
Usa :
WHERE se.segus_cod ~ '1.'
o
WHERE se.segus_cod ~~ '1.'
y te da todos los que inicien con 1.
Date: Tue, 12 May 2009 10:41:19 -0500
Subject: [pgsql-es-ayuda] Problema con una consulta...
From: lzevallos(at)lobosistemas(dot)com
To: pgsql-es-ayuda(at)postgresql(dot)org
Hola a todos
Bueno es una inche consulta que no sale haber si alguien me ayuda gracias
(select s.segus_cod as segus
from tbl_negociacionpreciodet n,
tbl_tarifariodet td
,tbl_segus s
where n.negociacionpreciodet_tcod=td.tarifariodet_cod
and n.negociacionpreciodet_tarifariodet_item=td.tarifariodet_item
and (s.segus_tarifariodet_cod=td.tarifariodet_cod
and s.segus_tarifariodet_item=td.tarifariodet_item))
me da de resultado:
segus
"1"
"2.2.12"
Tengo una tabla tbl_segus que tiene una columna donde hay clasificaciones o niveles
1
1.1
1.2
1.2.1
2
2.1
yo quiero que me de como resultado todos los del nivel 1 osea con un like '1%' se resuelve pero yo consulto asi:
select se.* from tbl_segus se
where se.segus_cod like --'1%'
Usa :
WHERE se.segus_cod ~ '1.'
o
WHERE se.segus_cod ~~ '1.'
y te da todos los que inicien con 1.
(select s.segus_cod as segus
from tbl_negociacionpreciodet n,
tbl_tarifariodet td
,tbl_segus s
where n.negociacionpreciodet_tcod=td.tarifariodet_cod
and n.negociacionpreciodet_tarifariodet_item=td.tarifariodet_item
and (s.segus_tarifariodet_cod=td.tarifariodet_cod
and s.segus_tarifariodet_item=td.tarifariodet_item)
and se.segus_tarifariodet_cod=s.segus_tarifariodet_cod
and se.segus_tarifariodet_item=s.segus_tarifariodet_item
)||'%'
y me sale lo mismo solo
"1"
"2.2.12"
Si alguien podria ayudarme se lo agradeceria.
--
Luis Zevallos
DBA Administrador de DB & SRVR
Lobo Sistemas S.A.C
tel: +5154958310833
http://www.lobosistemas.com
_________________________________________________________________
Windows Live Hotmail now works up to 70% faster.
http://windowslive.com/Explore/Hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_faster_112008
From | Date | Subject | |
---|---|---|---|
Next Message | Marcos Ortiz Valmaseda | 2009-05-13 02:19:50 | Re: Ayuda con pg_top |
Previous Message | Alvaro Herrera | 2009-05-13 01:12:52 | Re: Problema con una consulta... |