I have a User table and a Flashcard table. I also have a Knowledge table which stores the Flashcards the User knows.


User: id | username | password

Flashcard: id | question | answer

Knowledge: user_id | flashcard_id | level

(The level field in the Knowledge table stores the expertise of the user on that flashcard, from 1 to 100)

My question is: There are Flashcards the User hasn't seen yet, so he has no 'knowledge' about them (no entry in the Knowledge table has that Flashcard for that User). In this case, I want to show those cards first. Then I want to order the rest by Knowledge level. So, if it has no entry in the knowledge table show it first, then show the flashcards that have level 1, then level 2, ... level n, in that order. Is there a way to do this in Propel2? Preferably a query that returns a Collection like



Thank you for your amazing input!

0 Answers