Re: CREATE FUNCTION QUE RETORNA UNA TABLA

From: "jose javier parra sanchez" <jojapasa(at)gmail(dot)com>
To: dariocarnelutti(at)gmail(dot)com
Cc: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: CREATE FUNCTION QUE RETORNA UNA TABLA
Date: 2008-03-12 16:42:39
Message-ID: 99f1636c0803120942i135adf28n6e20f12548354d9f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Es solo una opinion, pero lo que quieres hacer te quedaria mas limpio
usando una vista.

El 12/03/08, Dario Carnelutti <dariocarnelutti(at)gmail(dot)com> escribió:
>
>
>
>
> Hola soy totalmente nuevo en Postgre y quiero saber si se puede hacer lo
> siguiente en Postgre
>
>
>
> CREATE FUNCTION Sales.fn_SalesByStore (@storeid int)
>
> RETURNS TABLE
>
> AS
>
> RETURN
>
> (
>
> SELECT P.ProductID, P.Name, SUM(SD.LineTotal) AS 'YTD Total'
>
> FROM Production.Product AS P
>
> JOIN Sales.SalesOrderDetail AS SD ON SD.ProductID = P.ProductID
>
> JOIN Sales.SalesOrderHeader AS SH ON SH.SalesOrderID = SD.SalesOrderID
>
> WHERE SH.CustomerID = @storeid
>
> GROUP BY P.ProductID, P.Name
>
> );
>
> GO
>
>
>
> Es una funcion que retorna un recordset o una tabla.
>
>
>
> Si no se puede hacer de esa forma, de cual manera se puede lograr el mismo
> resultado?
>
>
>
> Muchas gracias de antemano,
>
>
>
> Dario Carnelutti

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Guillermo Munoz 2008-03-12 16:57:43 Re: Error con el COPY ???????????
Previous Message MIGUEL CANCHAS 2008-03-12 16:42:01 RE: Error con el COPY ???????????