SELECT DISTINCT NAME 姓名, ( select max(arrivetime) from inbox where arrivedate='10-09-01' and left(msg,1)='D'and mbno=tel1) 到达时间, ( select msg from inbox where arrivedate='10-09-01' and arrivetime=( select max(arrivetime) from inbox where arrivedate='10-09-01' and left(msg,1)='D'and mbno=tel1)) 到达短信, ( select max(arrivetime) from inbox where arrivedate='10-09-01' and left(msg,1)='W'and mbno=tel1) 完成时间, ( select msg from inbox where arrivedate='10-09-01' and arrivetime=( select max(arrivetime) from inbox where arrivedate='10-09-01' and left(msg,1)='W'and mbno=tel1)) 完成短信, fz 分组 FROM inbox, txl WHERE mbno = tel1 order by name
在图片上点右键--属性--复制URL--新开一个浏览器页面--粘贴到地址栏--回车--然后回来CSDN刷新页面,或者直接在新开的页面看图。
( select max(arrivetime) from inbox where arrivedate='10-09-01' and left(msg,1)='D'and mbno=tel1) 到达时间,
( select msg from inbox where arrivedate='10-09-01' and arrivetime=( select max(arrivetime) from inbox where arrivedate='10-09-01' and left(msg,1)='D'and mbno=tel1)) 到达短信,
( select max(arrivetime) from inbox where arrivedate='10-09-01' and left(msg,1)='W'and mbno=tel1) 完成时间,
( select msg from inbox where arrivedate='10-09-01' and arrivetime=( select max(arrivetime) from inbox where arrivedate='10-09-01' and left(msg,1)='W'and mbno=tel1)) 完成短信,
fz 分组
FROM inbox,
txl
WHERE mbno = tel1
order by name