db(....).select(...,distinct=True)

I think it does what you ask. if you give it a try, please let us
know.

Massimo

On Jun 1, 10:47 pm, jcorbett <[email protected]> wrote:
> I was trying to do a select, where I have distinct records, but only
> for certain fields.  While I don't want to restrict the field on
> input, when doing a query sometimes I want to eliminate duplates of a
> particular field.  Normally in SQL you could do a DISTINCT [field
> name], but the distinct in the select seems to do a global distinct on
> all fields.
>
> A simple example would be a table with an id, name, created
> (timestamp), and possibly other fields.  although normally multiple
> inserts with the same name are allowed (because of the other fields),
> when doing a report on this data I want to restrict the output by the
> "newest" items with a unique name (eliminating rows with duplicate
> names).
>
> Right now with web2py all I can see is some form of post processing,
> but that would be unfortunate.  Any other ideas?  Am I forced to write
> custom sql?
>
> Jason
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to