select b.qdm,
b.updtime,
isnull(b.interval,0) as iInterval,
isnull(b.ave100je,0) as saj 
from shhq..shtoday a ,shapp..shday b 
where a.updtime = 
(select max(c.updtime) from shhq..shtoday c where c.qdm=a.qdm)
  and a.qdm=b.qdm 
and b.updtime=(select max(c.updtime) from shapp..shday c where c.qdm=b.qdm)
order by a.qdm