Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Unir varias tablas en un solo registro


  • From: "Calabaza Calabaza" <calalinux(at)gmail(dot)com>
  • To: pgsql-es-ayuda(at)postgresql(dot)org
  • Subject: Re: Unir varias tablas en un solo registro
  • Date: Thu, 27 Mar 2008 18:19:19 -0400
  • Message-id: <958993320803271519m6e7cab05h5167b664055772a9(at)mail(dot)gmail(dot)com>

Estuve reordenando los datos y entendí mejor tu estructura,
idficha   tela
125       JERSEY SIMPLE
                                         20X 19/1 COC
                                         50X 12/1 ALGOD. OPEN
                                         30X 24/75 COC

Creo que una tela tiene varios hilados y un hilado tiene un hilo?

prueba esto a ver que sale:

Select
a.idficha,
c.nomfamil||' '||d.nomdescr||' '||

array(Select
z.porcentaje||' '||x.titulo||' '||x.desc_hilo as hilado_con_hilo
from
ficha_hilados z left join mhilos x on (z.idhilo=x.idhilo)
where z.idficha=a.idficha)

 as tela
from
ficha_tejeduria a
left join mfamilias c on (a.idfamil=c.idfamil)
left join mdescripcion d on (a.iddescr=d.iddescr)

Teóricamente debería devolver algo como:
idficha   tela
125       JERSEY SIMPLE  { 20X 19/1 COC,50X 12/1 ALGOD. OPEN,30X 24/75 COC}

El corchete {} es porque la funcion array()....
Lo que no estoy seguro es si se puede concatenar un array con un
string, ahora no lo puedo probar, pero al llegar a mi casa, me creo la
db de prueba y veo que tal sale...

Exitos!
-- 
§~^Calabaza^~§ from Villa Elisa, Paraguay
---------------
A hendu hína: TIERRA SANTA - Vikingos
http://foxytunes.com/artist/tierra+santa/track/vikingos



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group