我已经阅读了有关使用子查询的类似帖子,但不知道如何将其应用于我的需求。
我有两个药表:
Generics带有字段GenericID和GenericName
并DrugCaseCounts带有字段GenericID(指向 的链接Generics),DrugName以及Cases
Generics。_ GenericName是药物中的活性成分,例如氟西汀,和DrugCaseCounts。DrugName是品牌名称,例如百忧解。 DrugCaseCounts. Cases是出现该品牌名称的案例报告的数量。一个可以有超过 10DrugCaseCounts条记录(不同的品牌名称)Generics。GenericID.
我想生成一个列表,显示:
Generics. GenericID, Generics. GenericName, DrugCaseCounts. DrugName,Cases
列出前 10 名DrugCaseCounts。DrugName记录,GenericID按案例降序分组。
我知道这需要 DrugCaseCounts 表上的子查询,但我不知道如何陈述它。