SELECT S.SNAME FROM Student as S INNER JOIN Book as B ON S.SID=B.SID INNER JOIN Author as A ON B.BID=A.BID WHERE B.BPRICE>1000 GROUP BY A.BID,S.SNAME HAVING COUNT(A.BID)>1
SELECT DISTINCT(s1.SNAME) FROM Student s1 JOIN BOOK b1 ON s1.SID = b1.SID WHERE b1.BPRICE > 1000 AND EXISTS ( SELECT COUNT(a.AID) FROM Book b2 JOIN Author a ON b2.BID = a.BID WHERE s1.SID = b2.SID GROUP BY a.AID HAVING COUNT(a.AID) > 1 )
select * from Student st inner join Book id on st.SID =id.sid inner join Author at on at.bid=st.bid
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)