Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
BluefoxBoy
Starting Member
2 Posts |
Posted - 2013-09-07 : 03:52:49
|
I have tables named books,supplier, publisher & reason_deleted. The publisher and supplier data are in publisher and supplier tables,books data in books table with publisher and supplier id, and reason_deleted table contains id of books that were deleted. When I write the queryselect b.idno,b.title,pub.pub_name,dr.reason,dr.date_deleted,sup.sup_namefrom books b inner join reason_deleted dr on dr.book_id=b.idno inner join publisher pub on b.pub_id=pub.idno inner join supplier sup on b.sup_id=sup.idnoI get results. But among them, some books which are missing supplier/publisher are not shown (means supplier id or publisher id is null in the books table). I need all the books which were deleted whether or not they have supplier or publisher. How can I achieve this? |
|
bitsmed
Aged Yak Warrior
545 Posts |
Posted - 2013-09-07 : 04:02:59
|
change the last two "inner join" to "left outer join" |
|
|
BluefoxBoy
Starting Member
2 Posts |
Posted - 2013-09-07 : 06:46:05
|
Dank You |
|
|
|
|
|