select c.dzzh,a.xm,a.dhhm,c.txm,b.sm,c.jyrq
from reader as a,book as b,
(
select dzzh,txm,jyrq
from borrow
where hsrq is null
) as c
where a.dzzh = c.dzzh and b.txm = c.txm
使用左联就可以了
mysql 的判断为null要用 hsrq is NULL 而不是用等号
select r. dzzh, r. xm,r. dhhm,b. txm,k. sm, b. jyrq from borrow b left join reader r on b.dzzh = r. dzzh left join book k on b. txm^=k. txm where b. hsrq is NULL