Sorry, it's in my views :)

{{extend 'layout.html'}}
<h2>Message Boards</h2>
<table align="center" width="90%" cellspacing="1" cellpadding="3"
class="data">
<tr>
<th>Board</th>
<th>Threads</th>
<th>Posts</th>
<th>Last Topic</th>
</tr>
{{for board in query:}}
<tr>
<td>{{=A(board.mb_boards.name, _href=URL(r=request, f='view',
args=board.mb_boards.id))}}<br />{{=board.mb_boards.description}}</td>
<td>{{=board.mb_boards.mb_posts.count()}}</td>
<td>{{=board.mb_boards.keys()}}</td>
<td></td>
</tr>
{{pass}}
</table>

On Apr 2, 6:38 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> what is "board"?
>
> On Apr 2, 5:20 pm, TheDude <officed...@gmail.com> wrote:
>
> > SQL Works! However...
>
> > {{=board.mb_boards.keys()}}
> > brings up:
> > ['update_record', 'mb_posts', 'description', 'id', 'name']
>
> > As you can see, no mb_posts2 (mb_posts does not contain mb_posts2
> > either). So, I said to myself may be it's because of the .ALL within
> > the select. Still no go.
>
> > On Apr 2, 2:56 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > ry
>
> > > def index():
> > >     rows = (db.mb_posts.board_id==db.mb_boards.id)&
> > > (db.mb_posts.reply_to==0)
> > >     mb_posts2 = db.mb_posts.with_alias("mb_posts2")
> > >     rows2 = (mb_posts2.board_id==db.mb_boards.id)
> > >     query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(),
> > > mb_posts2.id.count(), left=(db.mb_posts.on(rows),mb_posts2.on
> > > (rows2)), groupby=db.mb_boards.id)
> > >     return dict(query=query)
>
> > > On Apr 2, 8:08 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > should be
>
> > > > def index():
> > > >     rows = (db.mb_posts.board_id==db.mb_boards.id)&
> > > > (db.mb_posts.reply_to==0)
> > > >     mb_posts2 = db.mb_posts.with_alias("mb_posts2")
> > > >     rows2 = (db.mb_posts2.board_id==db.mb_boards.id)
> > > >     query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(),
> > > > db.mb_posts2.id.count(), left=(db.mb_posts.on(rows),db.mb_posts2.on
> > > > (rows2)), groupby=db.mb_boards.id)
> > > >     return dict(query=query)
>
> > > > On Apr 1, 11:13 pm, TheDude <officed...@gmail.com> wrote:
>
> > > > > def index():
> > > > >     rows = (db.mb_posts.board_id==db.mb_boards.id)&
> > > > > (db.mb_posts.reply_to==0)
> > > > >     rows2 = (db.mb_posts.board_id==db.mb_boards.id)
> > > > >     mb_posts2 = db.mb_posts.with_alias("mb_posts2")
> > > > >     query = db().select(db.mb_boards.ALL, db.mb_posts.id.count(),
> > > > > db.mb_posts2.id.count(), left=(db.mb_posts.on(rows),db.mb_posts2.on
> > > > > (rows2)), groupby=db.mb_boards.id)
> > > > >     return dict(query=query)
>
> > > > > gives me
> > > > > OperationalError: (1066, "Not unique table/alias: 'mb_posts'")
>
> > > > > However, should mb_posts2 show itself as LEFT JOIN mb_posts AS
> > > > > mb_posts2 ?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to