Re: [web2py] concatenating strings in group by select

2015-06-04 Thread Kiran Subbaraman

db.executesql(your_sql_statement) should work, I guess.


Kiran Subbaraman
http://subbaraman.wordpress.com/about/

On Thu, 04-06-2015 8:06 PM, 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-14001400-2200
51;2015-05-01;0600-1400
52;2015-05-01;1400-22002200-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.


Thank you
--
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 
mailto:web2py+unsubscr...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
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.


[web2py] concatenating strings in group by select

2015-06-04 Thread Yebach
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-14001400-2200
51;2015-05-01;0600-1400
52;2015-05-01;1400-22002200-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.

Thank you

-- 
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.