我的SQL数据库中有以下表格:

authors:
    name varchar
    id int Primary Key
publications:
    id int Primary Key
    title mediumtext
    year int
authorsJoinTable:
    authorId -> Foreign Key to the authors table
    publicationID -> Foreign Key to the publications Table
    sequenceId int


我想知道是否有可能从publicationIds中获取所有authorsJoinTable
year降序排列?
提前致谢,
院长

最佳答案

SELECT publicationID
FROM authorsJoinTable a JOIN publications p
     ON (p.Id = a.publicationId)
ORDER BY p.Year DESC

10-01 23:23