这样一个SQL
select t1.*,
(select concat(concat(concat(concat(col1,col2),col3),col4),col5)
from (
case when bitand(T2.VERIREASON ,power(2,1)) = power(2,1) then '#1#,' else '' end col1,
case when bitand(T2.VERIREASON ,power(2,2)) = power(2,2) then '#2#,' else '' end col2,
case when bitand(T2.VERIREASON ,power(2,3)) = power(2,3) then '#3#,' else '' end col3,
case when bitand(T2.VERIREASON ,power(2,4)) = power(2,4) then '#4#,' else '' end col4,
case when bitand(T2.VERIREASON ,power(2,5)) = power(2,5) then '#5#' else '' end col5) ab) VERIREASON ,
FROM V_STUDENT T1
INNER JOIN GD_DATASENDER T2 ON T1.SIGNUPNO = T2.STUDENTCODE
我想显示出来,现在执行结果是SQL有错误
请大家帮忙修改一下
select t1.*,
(select concat(concat(concat(concat(col1,col2),col3),col4),col5)
from (
case when bitand(T2.VERIREASON ,power(2,1)) = power(2,1) then '#1#,' else '' end col1,
case when bitand(T2.VERIREASON ,power(2,2)) = power(2,2) then '#2#,' else '' end col2,
case when bitand(T2.VERIREASON ,power(2,3)) = power(2,3) then '#3#,' else '' end col3,
case when bitand(T2.VERIREASON ,power(2,4)) = power(2,4) then '#4#,' else '' end col4,
case when bitand(T2.VERIREASON ,power(2,5)) = power(2,5) then '#5#' else '' end col5) ab) VERIREASON ,
FROM V_STUDENT T1
INNER JOIN GD_DATASENDER T2 ON T1.SIGNUPNO = T2.STUDENTCODE
我想显示出来,现在执行结果是SQL有错误
请大家帮忙修改一下
(select concat(concat(concat(concat(col1,col2),col3),col4),col5)
from (
case when bitand(T2.VERIREASON ,power(2,1)) = power(2,1) then '#1#,' else '' end col1,
case when bitand(T2.VERIREASON ,power(2,2)) = power(2,2) then '#2#,' else '' end col2,
case when bitand(T2.VERIREASON ,power(2,3)) = power(2,3) then '#3#,' else '' end col3,
case when bitand(T2.VERIREASON ,power(2,4)) = power(2,4) then '#4#,' else '' end col4,
case when bitand(T2.VERIREASON ,power(2,5)) = power(2,5) then '#5#' else '' end col5) ab) VERIREASON ,
concat(concat(concat(concat(col1,col2),col3),col4),col5)
-->
col1+col2+col3+col4+col5
(select concat(concat(concat(concat(col1,col2),col3),col4),col5)
from ( select
case when bitand(T2.VERIREASON ,power(2,1)) = power(2,1) then '#1#,' else '' end col1,
case when bitand(T2.VERIREASON ,power(2,2)) = power(2,2) then '#2#,' else '' end col2,
case when bitand(T2.VERIREASON ,power(2,3)) = power(2,3) then '#3#,' else '' end col3,
case when bitand(T2.VERIREASON ,power(2,4)) = power(2,4) then '#4#,' else '' end col4,
case when bitand(T2.VERIREASON ,power(2,5)) = power(2,5) then '#5#' else '' end col5) ab) VERIREASON ,
FROM V_STUDENT T1
INNER JOIN GD_DATASENDER T2 ON T1.SIGNUPNO = T2.STUDENTCODE 这样就OK了。
不是这个的问题
select concat(concat(concat(concat(col1,col2),col3),col4),col5) v from
(
select case when bitand(t.studentcode ,power(2,1)) = power(2,1) then '#1#,' else '' end col1,
case when bitand(t.studentcode ,power(2,2)) = power(2,2) then '#2#,' else '' end col2,
case when bitand(t.studentcode ,power(2,3)) = power(2,3) then '#3#,' else '' end col3,
case when bitand(t.studentcode ,power(2,4)) = power(2,4) then '#4#,' else '' end col4,
case when bitand(t.studentcode ,power(2,5)) = power(2,5) then '#5#' else '' end col5
from temp_regstudent t) tt
这个是正确的SQL
我的意思是把这样的写法放到我在1楼的SQL中,我不会放