Hi,

I need to show a SQLTABLE with joined data but without repeated
information (like grouping but showing all rows).

Let's say I have the following model:

        db.define_table('one', Field('aa'), Field('bb'), Field('cc'),
format='%(aa)s')
        db.define_table('many', Field('one', 'reference one'), Field('xx'),
Field('yy'), Field('zz'))

And the following function:

        def join():
            rows = db(db.one.id==db.many.one).select()
            return dict(rows=rows)

This shows all rows correctly but with repeated data for 'one':

many.id many.one        many.xx many.yy many.zz one.id  one.aa  one.bb  one.cc
1       a1      a1_x1   a1_y1   a1_z1   2       a1      b1      c1
2       a1      a1_x2   a1_y2   a1_z2   2       a1      b1      c1
3       a2      a2_x1   a2_y1   a2_z1   3       a2      b2      c2
4       a2      a2_x2   a2_y2   a2_z2   3       a2      b2      c2
5       a3      a3_x1   a3_y1   a3_z1   4       a3      b3      c3

How can I show this same view (with the same number of rows) but only
showing the 'one' data once (for the first occurrence) as follows?.

many.id many.one        many.xx many.yy many.zz one.id  one.aa  one.bb  one.cc
1       a1      a1_x1   a1_y1   a1_z1   2       a1      b1      c1
2       a1      a1_x2   a1_y2   a1_z2   2
3       a2      a2_x1   a2_y1   a2_z1   3       a2      b2      c2
4       a2      a2_x2   a2_y2   a2_z2   3
5       a3      a3_x1   a3_y1   a3_z1   4       a3      b3      c3

Note the empty spaces in order to show the 'one' data once only (on
first occurrence).

Thanks,

   Carlos

Reply via email to