Hi Carlos, inside the select you can specify which fields to bring back, I think you want:
rows = db(db.one.id==db.many.one).select(db.many.id, db.many.xx, db.many.yy, db.many.zz, db.one.aa, db.one.bb, db.one.cc) On Dec 12, 9:58 am, Carlos <[email protected]> wrote: > Hi Massimo, > > What do you mean?, that shows the same result (with repeated 'one' > data) in the SQLTABLE, doesn't it?. > > Thanks, > > Carlos > > On Dec 12, 1:23 am, mdipierro <[email protected]> wrote: > > > You can do, for example: > > > rows = > > db(db.one.id==db.many.one).select(db.many.id,db.many.one,db.many.xx,db.many > > .yy,db.many.zz,db.one.aa,db.one.bb,db.one.cc) > > > On Dec 11, 12:27 pm, Carlos <[email protected]> wrote: > > > > 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 > >

