On Tue, Jun 2, 2009 at 4:48 PM, SergeyPo <ser...@zarealye.com> wrote: > > This works for sure in sqlite, mysql and oracle: > > db().select(db.tablename.fieldname, distinct=True) > > and this is correct approach because I can not imagine biz logic when > you want to select distinct values AND their ID's etc. fields. You > normally use select distinct when you need a list of available values > in a field.
practical example from my own web app: A doctor prescribes medication. He can select it from a pharmaceutical database. He can select the drug by generic or brand name. Each drug comes in a variety of forms, strengths, packet sizes etc. plus some incur health system subsidies, some barnd price premiums etc. In most instances, I am not interested whatsoever in 20 manufacturers producing the same product and it coming in a variety of packet sizes - all I want is Amoxycilin trihydrate tablets 500mg (and not a hundred variations thereof cluttering my selection widget). There are some 60,000 drug product entries in the larger drug database - and less than 2000 unique drugs But, in order to call up product information and to check allergies and interactions - I need the id of the drug. Just one of a great many practical examples. Horst --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---