sql查询涉及3个表

时间:2016-06-09 01:07:43

标签: sql firebird

我有3张桌子,如: -

BK_Title    Num_Copies  Stream
---------------------------------------
A_Book      2       Science
B_Book      1       History

我想以

的形式获取记录

     import olefile
     ole = olefile.OleFileIO('mypowerpoint.ppt')
     text = ole.openstream('PowerPoint Document')
     read = text.read()
     print(read)

我该怎么做。请指教。

1 个答案:

答案 0 :(得分:1)

试试这个:

SELECT BK_Title, COUNT(Table_2.bk_isbn) AS Num_Copies, Table_2.strm_name AS Stream
FROM Table_1
JOIN Table_2 on (Table_1.id = Table_2.bk_no)
JOIN Table_3 on (Table_1.strm_id = s_id)
GROUP BY BK_Title, strm_name
ORDER BY BK_Title