Mauro,

i think a short example would be really helpful .. especially related
to your data-structure .. and the expected behaviour. do you already
have an reduce function, but it does not work like you'd have it to?

Regards
Stefan

On Mon, May 16, 2011 at 4:52 PM, Mauro Fagnoni <[email protected]> wrote:
> Hi all, i've to convert this sql query into couchdb  function but i've some
> problem with reduce function. Some one can help me??
> Many thanks and best regards
>
> *
> SQL QUERY:*
>
> SELECT
>             L_RETURNFLAG,
>             L_LINESTATUS,
>     sum(L_QUANTITY)as sum_qty,
>     sum(L_EXTENDEDPRICE) as sum_base_price,
>     sum(L_EXTENDEDPRICE*(1-L_DISCOUNT)) as sum_disc_price,
>     sum(L_EXTENDEDPRICE*(1-L_DISCOUNT)*(1+L_TAX)) as sum_charge,
>     avg(L_QUANTITY) as avg_qty, avg(L_EXTENDEDPRICE) as avg_price,
>     avg(L_DISCOUNT) as avg_disc,count(*) as count_order
> FROM
>             LINEITEM
> WHERE
>             L_SHIPDATE <= date '1998-12-01' - interval '90' day"
>
> GROUP BY
>            L_RETURNFLAG,
>            L_LINESTATUS
> ORDER BY
>            L_RETURNFLAG,
>            L_LINESTATUS
>
>
> couchdb function by curl
>
> curl -X POST http://127.0.0.1:5984/testdb/_temp_view -H "Content-Type:
> application/json" -d'{"map":"function("doc"){if(doc.l_shipdate <=
> 1998-09-01) emit(doc)}" "reduce":"function{if(.....)}}
>
>
> --
> -----------------------------------------------
> [-------WHOAMI------] Mauro Fagnoni
> [----------ICQ#---------] 279572903
> [--------MSNID--------] [email protected]
> [--YAHOOMSNID--] [email protected]
> [--GOOGLETALK--] [email protected]
> [-GOOGLEWAVE-] [email protected]
> [------JABBER-------] [email protected]
> [------SKYPE--------] mauro.fagnoni
> [-----LinuxUser#----] 346345
> [----------Blog---------] http://kingmauro.wordpress.com
> -----------------------------------------------
>

Reply via email to