日期:2014-05-17 浏览次数:20767 次
SELECT NAME,AGE,SALES FROM USER WHERE DATE_TIME=TO_DATE('2011-11-21','yyyy-MM-dd') AND NAME='hello';
seelct a.name ,nvl(b.age,0) as age,nvl(b.sales,0) as sales from (select 'hello' as name from dual) a left join USER b on a.name=b.name where b.DATE_TIME=TO_DATE('2011-11-21','yyyy-MM-dd')
------解决方案--------------------
seelct a.name ,nvl(b.age,0) age,nvl(b.sales,0) sales from (select name from table_user where name='hello') a left join USER b on a.name=b.name where b.DATE_TIME=TO_DATE('2011-11-21','yyyy-MM-dd')
------解决方案--------------------
参考代码:
SELECT NAME, NVL(AGE, 0), NVL(SALES, 0) FROM USER WHERE DATE_TIME=TO_DATE('2011-11-21','yyyy-MM-dd') AND NAME='hello';