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
-~----------~----~----~----~------~----~------~--~---