Ok I think I solved my problem by using grid's groupby argument, thanks to this 
post 
<http://stackoverflow.com/questions/164319/is-there-any-difference-between-group-by-and-distinct>
 
and this post. 
<https://groups.google.com/forum/?fromgroups=#!searchin/web2py/grid$20distinct%7Csort:relevance/web2py/glEWmYRLSWQ/Y_bEVtZfPBoJ>

However a distinct argument for grid would still be great.

On Wednesday, December 21, 2016 at 3:56:13 AM UTC-5, H. Das wrote:
>
> Hi Massimo, I think this still hasn't been added yet. 
>
> I too am doing several inner joins with grid and I'm getting some rows 
> that I consider duplicates and would like to get rid of them. The most 
> straightforward way to remove these duplicates is perhaps calling select() 
> on the Set object with the distinct keyword argument, or perhaps even use 
> exclude() on the Rows object. To my knowledge grid does not yet have 
> equivalents to distinct and exclude, unfortunately.
>
> Will equivalents to distinct/exclude be added to grid anytime soon? I am 
> surprised something so advanced like grid doesn't have this.
>
> Or would you know another way to remove duplicates from grid? 
>
> Please advise.
>
> On Wednesday, April 10, 2013 at 9:14:12 AM UTC-4, Massimo Di Pierro wrote:
>>
>> Please open a ticket and we can add this.
>>
>> On Wednesday, 10 April 2013 04:46:14 UTC-5, Calvin wrote:
>>>
>>> Hi
>>>
>>> I have been struggling with how one could get just distinct records to 
>>> show with SQLFORM.grid if the query passed to it involved more than one 
>>> table? Doing an inner join tends to generate a lot of non-unique rows and 
>>> hence it would be important to just filter out the unique ones. With 
>>> select, there is support for the distinct keyword but this is not the case 
>>> with SQLFORM.grid. 
>>>
>>> Using the groupby keyword is one approach but this can get somewhat 
>>> tedious having to specify the fields to group by in advance and hence, I 
>>> would like to understand if the omission of support for distinct in 
>>> SQLFORM.grid is by design?
>>>
>>> Many thanks
>>> Calvin
>>>
>>

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