On Thursday, June 4, 2015 at 7:36:24 AM UTC-7, Yebach wrote:
>
> Hello
>
> I have the following SQL for PostgreSQL
>
> select 
> rw_worker
> , rw_date
> , array_to_string(array_agg(distinct results_woshi.rw_shift),'&') AS shifts
>
> from 
> results_woshi 
> where 
> rw_date > '2015-01-01' and rw_script = 42 
> group by rw_worker, rw_date
> order by rw_date
>
> The result is
>
> 49;"2015-05-01";"2200-0600"
> 50;"2015-05-01";"0600-1400&1400-2200"
> 51;"2015-05-01";"0600-1400"
> 52;"2015-05-01";"1400-2200&2200-0600"
>
>
> any ideas how to translate it to web2py DAL
>
> So I have to concatenate strings in group by statement where strings are 
> concatenated in order.
>

Not sure I can answer the question you're really asking, but here's a 
couple of posts I've made in the past about dates:

<URL:https://groups.google.com/d/msg/web2py/-VPp4OaSskI/SvAfYL6yoqEJ>
(does a timedelta calculation on two rows from a query), and also shows an 
db.executesql() with an "older than" clause)

and 
<URL:https://groups.google.com/d/msg/web2py/MNzcV1dsgMk/1nFl__MDrMoJ>
where I have a db(db.table matches month).select() that orders by the month.

/dps



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to