douzhi1972 2019-04-27 23:08
浏览 39

根据propel2中的关系检索和排序行

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

Tables:

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

KnowledgeQuery::create();

does.

Thank you for your amazing input!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度
    • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
    • ¥15 ETLCloud 处理json多层级问题
    • ¥15 matlab中使用gurobi时报错
    • ¥15 这个主板怎么能扩出一两个sata口
    • ¥15 不是,这到底错哪儿了😭
    • ¥15 2020长安杯与连接网探
    • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么