Home > database >  Select the multiple information in the data window as query condition how to implement
Select the multiple information in the data window as query condition how to implement

Time:09-20

An interface window, there are two data in dw_1 is A window, the selection criteria dw_2 window is to display results, such as dw_1 in five departments have A B C D E, I can only choose A and C department as A condition of the query,
The main problem is 1, and how to take out more information at the same time; 2, how to write the query conditions to dynamic SQL statements

CodePudding user response:

For our great god help

CodePudding user response:


Ls_oldsql=dw_1. Getsqlselect ()
Ll_cnt=pos (ls_oldsql, 'where')
If ll_cnt=0 then
Ls_w='where'
Ls_A='and'
Ls_sql=coulmn like ls_rb
Ls_newsql=ls_oldsql + ls_w + ls_sql + ls_A

CodePudding user response:

dw_1 has A B C D E five departments, I can only choose A and C department as A condition of the query,
If only in this way, can pass an array in the SQL used in conditions

CodePudding user response:

With q!!!!!!!!!!

CodePudding user response:

As a condition only department? Simple, dw_1 data window object under construction, add a column for SQL statements, such as:
Select '0' as an isselected, - as a selection marker
Dep_id, - a database of department ID
Dep_name - a database of department name
The from department, department in the database table
Data window object is generated by this statement will be more than one column an isselected, when the design, the column for the checkbox editstyle, 1 is selected, zero is not selected, so that it can be for dw_1 easily implement multiple effect,
Then generate dw_2 conditions, this requires the use of circulation, circulation dw_1, check which line an isselected is 1, dep_id out of it, string into condition, to dw_2 in the where clause, or a little bit more simple, don't change dw_2 SQL statements, but with the modified setfilter dw_2 filter conditions, look at the actual conditions, if change the SQL statement, each time to retrieve database again, if use setfilter, first time slowly,
  • Related