thanks for the follow-up Jon; no I didn't see your post concerning the 3-way join.
I gather the SQL below is simply a restatement of what you put in your other post.
You are defining two joins to the neighbourhood table, and using an alias to do so. The way you define the alias is simply to state the name of the table (neighbourhood) and then its alias (nhfr or nhto). Is that right? I'll poke around tonight with that and see what I come up with.
While I did get a solution using SQLobject, by using a couple of pre-queries to define two IN lists, it would obviously be more elegant to be able to do it all in one go with SQLobject.
A couple of observations:
The challenge I find is how to express SQL queries in SQLobject. What's missing for me in the site documentation is a recipe-style section where various typical SQL queries are expressed in SQLobject terminology. After reading SAM's 10-minute guide to SQL I was able to fashion together SQL queries to solve my problem, but hours of putzing around with SQLobject hasn't yet produced the desired results. Either SQLobject is more complicated than SQL, or we need more and better documentation. Or am I missing it somewhere, and I'm overlooking it?
I'd be willing to work on some recipes - at least as far as my knowledge goes. What I think we need a whole lot of is something like this:
"you want to select a single column from a table according to some criterion. here's how:
SQL: SELECT prod_name from products where prod_price < 3.49;
SQLobject: Product.Select(Product.q.prod_name, where=(Product.q.prod_price<3.49))
note: I have no idea whether the SQLobject expression is correct!
There are lots of examples of complicated SQLobject expressions in the documentation, with their equivalent SQL, which is great if you already know SQLobject and want to learn how to write SQL. But for many of us, I'd wager that we know some python, and a little SQL, and nothing about SQLobject, so we need examples that enable us to go in the other direction, from SQL to SQLobject.
thanks to a few gurus on the list, we can often get solutions to our problems. It would be great to be able to unload the work on them by having some recipes available so that they don't need to answer the same questions over and over. At the moment, there doesn't seem to be any way for users to contribute to the documentation.
Did you see my post concerning the 3-way join? That is your solution.