sql實現不同的需求

1、獲取形同時間的最大數

 select a.mobile,a.calltime,a.timelong
From test003 a
Where a.timelong=
(select max(timelong) from test003 b where a.mobile=b.mobile and convert(varchar(20),a.calltime,120)=
(select max(convert(varchar(20),c.calltime,120)) from test003 c where c.mobile=a.mobile ))
--group by a.mobile having count(a.mobile)>1
order by a.timelong desc

2、查詢內容爲NULL的字段

select * from  test_table where stu_num is NULL

修改爲空
update  test_table set stu_num=' ' where stu_num is NULL


發佈了22 篇原創文章 · 獲贊 42 · 訪問量 11萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章