如何使用SQL查询将2个表中的2个属性放入具有2个属性的1个表中

时间:2018-09-30 14:36:10

标签: sql

第一个表中的属性1:

SELECT PUBLISHERFULLNAME 
FROM publisher 
WHERE publisher.PUBLISHERID IN (SELECT PUBLISHERID 
                                FROM published_by
                                WHERE published_by.BOOKDESCID IN (SELECT BOOKDESCID 
                                                                  FROM book
                                                                  WHERE book.SUBJECTID IN (SELECT SUBJECTID FROM subject
                                                                                           WHERE SUBJECTTYPE = 'DataBases'))
                                                                                             AND published_by.ROLE = 'Publisher')

第一个查询的输出:

enter image description here

第二个表中的属性2:

SELECT TITLE 
FROM book
WHERE book.SUBJECTID IN (SELECT SUBJECTID 
                         FROM subject
                         WHERE SUBJECTTYPE = 'DataBases')

第二个查询的输出:

enter image description here

我想将这两个表放到具有2个属性的表中,这意味着同时显示出版商和书名。有人可以帮我吗。

非常感谢

0 个答案:

没有答案