昨天遇到个问题,编写:
select *
from table1
where id>(select MAX(id2) from table2)
发现没有记录返回,一直寻找其中的问题。
[@more@]后来想到由于table2现在还未录入数据,所以id2的值为null,今天查了下,可以利用isnull( )函数来解决。修改如下:
select *
from table1
where id>(select isnull(MAX(id2),0) from table2)
问题得到解决:)
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7946503/viewspace-1000725/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/7946503/viewspace-1000725/