From: | Josué Maldonado <josue(at)lamundial(dot)hn> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Set return function with union all |
Date: | 2004-09-21 19:09:00 |
Message-ID: | 41507C4C.1040408@lamundial.hn |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello list,
is there a way to write in plpgsql the query that returns a set of this:
create view xxx as
(select '3ARR' as level,
dpe_stamp from detpa
where dpe_productfk=1
order by 2 desc limit 1)
union all
(select '2CAM' as level,
dpe_stamp from detpc
where dpe_productfk=1
order by 2 desc limit 1)
union all
(select '1PRO' as level,
dpe_stamp from detpp
where dpe_productfk=1
order by 2 desc limit 1)
order by 1 desc limit 1 ;
I already tried to use the same code in for in code block, I have a
custom type and a empty table for the return setof, any idea or suggestion?
Thanks in advance
--
Sinceramente,
Josué Maldonado.
"El sabio habla porque tiene algo que decir; el tonto, porque tiene que
decir algo" -- Platon
From | Date | Subject | |
---|---|---|---|
Next Message | Christopher Petrilli | 2004-09-21 20:24:21 | Prioritizing queries |
Previous Message | Alvaro Herrera | 2004-09-21 19:08:10 | Re: Stored Procedures |