tblBookhead
BookHeadId,bookname,bookauthor,...
tblBookDetail
BookHeaddetailId,BookHeadId,数量
tblBookorder
orderid,BookHeaddetailId,orderqty
select * from tblBookhead bh inner join tblBookDetail bd on
bh.BookHeadId=bd.BookHeadId inner join tblBookorder br on
br.BookHeaddetailId=db.BookHeaddetailId where BookHeadId=1;
这将是后退好结果没问题。
但是现在如果BookHeadId = 1和orderqty = 5的qty为10,那么结果需要显示没有连接的剩余5个数量(我的期望值是tblBookorder中剩余数量的空值)
我的预期结果是:
BookHeadId, bookname, bookauthor,... BookHeaddetailId,BookHeadId,Qty,orderid,BookHeaddetailId , orderqty
1 1 john 1 1 10 1 1 5
1 1 john 1 1 10 null null null