开发者

Help with an SQL Query

开发者 https://www.devze.com 2023-03-08 11:29 出处:网络
i have this table that have this for example: NUM1BOXStatusDATA 134813119874107.03.21 149950119874810.12.31

i have this table that have this for example:

 NUM1    BOX     Status     DATA      
134813  119874     1    07.03.21
149950  119874     8    10.12.31

What I want to do is to select from the table COMERT, where boxID = 119874, and have status 1, but if in the table have more than one row, compare the dates to see if the date from status 1 is more actual than the others. If it doesn't to not return a开发者_如何学编程nything. How could I do this?


select * from Comert 
where boxID = 119874 and status=1 
and date=(select max(date) from comert where boxID = 119874)
0

精彩评论

暂无评论...
验证码 换一张
取 消