|
最佳回答 |
0
|
axingLv6专家互助发布于2020-4-28 16:52
|
select * from `客户信息表`
where 1=1
${if(len(p2)==0,"","and 客户编码='"+p2+"'")}
${if(len(p1)==0,"","and 客户名称='"+p1+"'")}
${if(len(p2)==0 && len(p1)==0,"","and 客户编码='1001'")}
|
|
|
|
最佳回答 |
0
|
xuejun1005Lv4见习互助发布于2020-4-28 16:45
|
|
|
|
|
最佳回答 |
0
|
snrtuemcLv8专家互助发布于2020-4-28 16:48
|
${if(len(p2)==0 && if(len(p1)==0 , "SELECT * FROM `客户信息表` where `客户编码` = 1001", "select * from `客户信息表` where 1=1"+if(len(p2)==0,"","and 客户编码='"+p2+"'")+if(len(p1)==0,"","and 客户名称='"+p1+"'") }
|
|
|
|
最佳回答 |
0
|
Rluoyu0oLv5见习互助发布于2020-4-28 17:03
|
select * from `客户信息表`
where 1=1
${if(len(p2)==0,"","and 客户编码='"+p2+"'")}
${if(len(p1)==0,"","and 客户名称='"+p1+"'")}
${if(len(p2)==0 && len(p1)==0,"and 客户编码='1001'","")} 不查询时显示第一条数据,查询是返回相应数据。
|
|
|