select case when col1='1' or col1='0' then col2 else 0 end,
case when col3='1' or col3='0' then col4 else 0 end from table1;
case when col3='1' or col3='0' then col4 else 0 end from table1;
select case when col1='1' or col1='0' then sum(col2) else 0 end,
case when col3='1' or col3='0' then sum(col4) else 0 end from table1;
顺便问一下:length()是标准sql吗?如果不是,对应的标准sql是什么?
select length('程序员') from dual;
length()是sqlplus中的系统函数。
oracle:length()
sqlserver:len()