这是手稿表
BOOKID AUTHORID BOOKNAME GENRE NOOFCOPIES AMOUNT
B105 A102 Diagnosis Journal 500 10000
B102 A102 The Essence Of Life Fiction 110 11000
B106 A102 Clinical Science Educational 125 18750
B104 A103 Mind Games Fiction 200 20000
B100 A102 Sublime Fiction 100 10000
B101 A105 C Programming Educational 125 18750
B103 A101 Scribe Journal 500 10000
B107 A101 Clinical Chemistry Educational 125 54646
B108 A103 Clinical Chemistry Educational 125 54646
如何编写查询以检索已发布最少书籍数量的authorid和authorname的列表?
例外输出是A105的详细信息......
答案 0 :(得分:0)
使用TOP关键字
Select TOP 1 BOOKID,AUTHORID from manuscript ORDER BY NOOFCOPIES ASC
使用子查询
SELECT m.AuthorId,a.AuthorName 来自作者a,Manuscript m WHERE(a.AuthorID = m.AuthorID)AND(m.Numberofcopies IN(SELECT MIN(Numberofcopies)FROM Manuscript));