CodePudding user response:
What is the databaseCodePudding user response:
Ms SQLCodePudding user response:
Change your query, for example:
Select * from table
Where: (a=a or: a='ALL')
And (a: b=b or: a='ALL')
And (c or: c=c='ALL')
Under your control query, do judgment, for example:
String ls_a ls_b, ls_b
Ls_a=trim (sle_1. Text)
Ls_b=trim (sle_2. Text)
Ls_c=trim (ddlb_1. Text)
If isnull (ls_a) or ls_a="' then ls_a='ALL'
If isnull (ls_b) or ls_b="' then ls_b='ALL'
If isnull (ls_c) or ls_c="' then ls_c='ALL'
Dw_1. Retrieve (ls_a ls_b, ls_c)
CodePudding user response:
Change your query, for example:select * from table
Where (a=: a or: a is null)
And (a: b=b or: b is null)
And (c or: c=c is null)
Under your control query, do judgment, for example:
string ls_a ls_b, ls_b
Ls_a=trim (sle_1. Text)
Ls_b=trim (sle_2. Text)
Ls_c=trim (ddlb_1. Text)
If isnull (ls_a) or ls_a="' then setnull (ls_a)
If isnull (ls_b) or ls_b="' then setnull (ls_b)
If isnull (ls_c) or ls_c="' then setnull (ls_c)
Dw_1. Retrieve (ls_a ls_b, ls_c)
CodePudding user response:
If is to query the same field where conditions IN retrieval, then arrayString ls_args []
If the trim (sle_1. Text) & lt;> "' then
Ls_args [upperbound (ls_args) + +]=sle_1. Text
End the if
If the trim (sle_2. Text) & lt;> "' then
Ls_args [upperbound (ls_args) + +]=sle_2. Text
End the if
.
Dw_1. Retrieve (ls_args)
CodePudding user response:
Can use the like, if not empty is like '%' + '%' + variableIf air is directly like '%' %