Pre-filter on id exists in table

arcadeicons

Member
I have a relationship table that ties game scores to the global title of the game in question. The relationship table is the specific-game that a user owns.

If a user deletes a game they own from their collection, it breaks the relationship between their previously posted scores and the global game title.

I want to write a pre-filter on my 'Latest Scores' module that checks to see if the game-relationship table id even exists before showing the score.

submit_score.gameID joins to select_game.id, so if select_game.id no longer exists I dont want to show that score.

something like

if submit_score.gameID EXISTS in select_game.id then display submit_score.score

I'm not sure how to construct this in the module pre-filter dropdowns.
 
I think the solution is simply not to let them delete games, just mark that as "no longer owned". Thats kind of the cardinal rule of relational databases. You don't delete rows that are still being referenced from other tables. Either you delete all the rows that reference it, or you have some ind of "status" field that shows whether it is active.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top