Thanks. Jonathan,
I was looking for SQL alias keyword "AS", the documentation is missing the index, so it is hard to search for py4web's implementation. I admit I didn't read the documentation start to end. I just read the sections of interest.
I think your example should be included in the documentation, any use of the count() will need to alias the results.
Anyway, I simply wrote it as SQL and executesql(). I am still debating whether to implement all my queries as SQL, although I like some aspect of py4web.