Please print

        myselect= db((db.mb_posts.board_id==request.args[0])&
(db.mb_posts.reply_to==None))._select(db.mb_posts.ALL,
db.auth_user.ALL,mb_posts2.id.count(), db
(mb_posts3.reply_to==db.mb_posts.id)._select(mb_posts3.id,
orderby=~mb_posts3.id, limitby=(0,1)), left=(db.auth_user.on
(rows),mb_posts2.on(rows2)), groupby=db.mb_posts.id)
        return dict(board=board, threads=threads)

then check if the generated myselect works from a MySQL shell.

Massimo

On Apr 4, 10:58 am, TheDude <[email protected]> wrote:
> Tried using this as logging 
> tool:http://mdp.cti.depaul.edu/AlterEgo/default/show/194
>
> But it didn't record where I have the problem at all (even after my
> patches).
>
> The controller:
> def view():
>     #try:
>         board = db(db.mb_boards.id==request.args[0]).select()[0]
>         rows = (db.auth_user.id==db.mb_posts.posted_by)
>         mb_posts2 = db.mb_posts.with_alias("mb_posts2")
>         rows2 = (mb_posts2.reply_to==db.mb_posts.id)
>         mb_posts3 = db.mb_posts.with_alias("mb_posts3")
>         threads = db((db.mb_posts.board_id==request.args[0])&
> (db.mb_posts.reply_to==None)).select(db.mb_posts.ALL,
> db.auth_user.ALL,mb_posts2.id.count(), db
> (mb_posts3.reply_to==db.mb_posts.id)._select(mb_posts3.id,
> orderby=~mb_posts3.id, limitby=(0,1)), left=(db.auth_user.on
> (rows),mb_posts2.on(rows2)), groupby=db.mb_posts.id)
>         return dict(board=board, threads=threads)
>     #except:
>     #    session.flash = "This board doesn't exist."
>     #   redirect(URL(r=request, f='index'))
>
> The problem:
> ProgrammingError: (1064, "You have an error in your SQL syntax; check
> the manual that corresponds to your MySQL server version for the right
> syntax to use near 'SELECT mb_posts3.id FROM mb_posts3, mb_posts WHERE
> mb_posts3.reply_to=mb_posts.i' at line 1")
>
> What I'm trying to do:
> mb_posts2 = The # of replies within that topic/thread (this works)
> mb_posts3 = The last reply created within that topic (sub query will
> do fine).
>
> I've tried various ways, the aggregate way, another left join, nothing
> seems to work. Asked a few people on the IRC as well, but they were
> just as lost as me. Anyone on here have any thoughts on the situation?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to