if a table join another table twice, the query cannot be done.
This issue goes more-or-less to some of the core assumptions I made -- many things are simpler if multiple joins to the same table aren't allowed -- for example:
- in a complex query, the columns you select are represented as a dictionary keyed by model.  if a model appears twice (i.e. is joined on twice) how do you represent which to select from?
- when multiple models are joined on how do you express which you are querying in the where clause?

I don't think I'll be able to fix this anytime soon, in other words.  Sorry!  Looks like sqa can do this but is kinda hacky: http://stackoverflow.com/questions/5780516/how-to-join-detail-twice-on-a-master-in-sqlalchemy
 One year on, it this still the case? I thought the Alias capability which allows for self joins would cause a new table alias to be created, but it doesn't appear to be the case.
 I see now that it works if you use the aliased model in a join, but it can't be used as the root of a select query.
 Correct -- you should be able to construct joins with aliased models, but not actually select them.  OK to close this out?

Code as follow:

``` python

class A(db.Model):
    f1 = CharField()
    f2 = CharField()
    f3 = CharField()

class B(db.Model):
    f1 = ForeignKeyField(A)
    f2 = ForeignKeyField(A)
    f3 = CharField()
q = {A:['*'],
             B:['f1'],
             B:['f1'],
             }
SelectQuery(B,q).join(A, on='f1').switch(B).join(A, on='f2')

```

I also try alias , not work either.
