I'm having trouble finding a clear example of this and I feel like what I'm doing is far more complicated than it should be. I'm sure someone in this group can show me a more elegant solution...
I have a table of Providers and a table of Games. Each provider can have multiple games so I also have a table: providers_games which is just a list of providerID and gameID to validate incoming data a query must have a secret_key for the provider and a secret_key for the game. I first find the providerID by looking up the provider_secret_key then find the gameID by looking up the game_secret_key. Now I want to check to make sure that there is, indeed, an entry in providers_games where providers_games.providerID == foundProviderID and provider_games.gameID == foundGameID I thought some clever use of IS_IN_DB would be my solution but that seems to be eluding me. my sudo-code: provider, = db(db.providers.key == providerKey).select() game, = db(db.games.key == gameKey).select() qset = db() qset = qset(db.providers_games.providerID == provider.id) qset = qset(db.providers_games.gameID == game.id) result, = qset.select() This is pretty ugly. I'm sure there is a better way. --