Ver Mensaje Individual
  #6 (permalink)  
Antiguo 23/08/2009, 16:09
Avatar de SPAWN3000
SPAWN3000
 
Fecha de Ingreso: marzo-2008
Ubicación: Bogota
Mensajes: 858
Antigüedad: 16 años, 2 meses
Puntos: 15
Respuesta: Hacer un select de un select

Muy util si se desea presetar los datos en columas.

ej:

select
tc.registro,
tc.valor1,
tc.cod_articulo,
Articulo = (select txt_artic from tciudad a where t.cod_articulo = tc.cod_articulo),
tc.cod_ciudad,
Ciudad = (select txt_ciudad from tciudad t where t.cod_ciudad = tc.cod_ciudad),
tc.cod_pais,
Pais = (select txt_pais from tpais p where p.cod_pais = tc.cod_pais)
from tcampos tc
order by tc.cod_articulo ASC;

Para el usuario esto es mas facil de visualizar.