|
最佳回答 |
0
|
snrtuemcLv8专家互助发布于2023-11-15 16:44
|
${if(edate=left(today(),7), "select * from xx where 1=1 and date = '"+edate+"'", "select * from xx where 1=1 and aaa and date ='"+edate+"'" )}
|
|
|
|
最佳回答 |
0
|
CD20160914Lv8专家互助发布于2023-11-15 16:43(编辑于 2023-11-15 16:44)
|
select * from XXX表 where 1=1 ${if(edate="2023-11","and date='"+edate+"'","and aaa and date='"+edate+"'")}
|
|
|
|
最佳回答 |
0
|
快乐星光Lv5中级互助发布于2023-11-15 16:44
|
select * from xx where 1=1 and date = '${edate}' ${if(edate='2023-11',"and aaa","")} '2023-11'可以用一个参数代替,在参数里面做today公式变形
|
|
|
|
最佳回答 |
0
|
kalashangLv3高级互助发布于2023-11-15 16:44
|
select * from xx where 1=1 and date = '${edate}' ${if(FORMAT(TODAY(),"yyyy-MM")=edate,""," and 1<>1")} union all select * from xx where 1=1 and aaa and date ='${edate}' ${if(FORMAT(TODAY(),"yyyy-MM")=edate," and 1<>1","")}
|
|
|
|
最佳回答 |
0
|
touyuan001Lv6中级互助发布于2023-11-15 16:46
|
${if(edate="2023-11","and 1=1","and 1=2")}
|
|
|