Hi sqlalchemy,

I'm a newbie to SA. I hope you could help me with the following problem.

Say that I have:

class Position(Base):
    __tablename__ = 'Position'
    id = Column('id', Integer, primary_key=True)
    position = Column('name', String) #center, guard etc'

class Player(Base):
    __tablename__ = 'Player'
    id = Column('id', Integer, primary_key=True)
    name = Column('name', String)
    team = Column('team', String)
    position_id = Column('position_id', Integer, ForeignKey('Position.id'))
    position = relation('Position')

class Stats(Base):
    __tablename__ = 'Stats'
    id = Column('id', Integer, primary_key=True)
    name = Column('name', String)
    points = Column('points', Integer)
    Player_id = Column('player_id', Integer, ForeignKey('Player.id'))
    league = relation('Player')

How can I retrieve the sum of points for each of the player positions? In
other words:
Retrieving the sum of points of all of the guards, centers, etc'.
How can this query be further limited to a specific team (simple
join+filter, right?)

Thanks,
Doron.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to