1. 程式人生 > >(原) mysql 查詢表中最大時間和非空值的合集

(原) mysql 查詢表中最大時間和非空值的合集

有表


查詢 time 最大  con 非空的時間   注:time  為整個表  最大

現有資料


要求結果   時間最大  並且有內容


sql語句

select a.id ,a.con, max(b.time) from test a, test b 
where a.con <> '' and a.time in (select max(time) from test where con <> '' );

還有沒有更好的方法啊。。。。。。。。。。。。。。。  

未完待續   +1s