Home > database >  Consult different database screening in another database table if there is not the same record
Consult different database screening in another database table if there is not the same record

Time:09-24

The select cCusCode cCusName, cCusAbbName cDCCode, cCCCode, cCusAddress, cCusEmail, cCusPerson, cCusPhone from Customer WHERE cCCCode='" + is_currNo + "' and cCusCode IN (select DWZD_DWBH from BL_DWZD)



The above statement is the judgment, in the same database table Customer and table BL_DWZD respectively store two database, how to use please use transaction to transform the SQL

CodePudding user response:

The same server:
Select cCusCode cCusName, cCusAbbName cDCCode, cCCCode, cCusAddress, cCusEmail, cCusPerson, cCusPhone from Customer WHERE cCCCode='" + is_currNo + "' and cCusCode IN (select DWZD_DWBH from the library.. BL_DWZD)

CodePudding user response:

Dw_1. Setsqlselect (" select cCusCode cCusName, cCusAbbName, cDCCode, cCCCode, cCusAddress, cCusEmail, cCusPerson, cCusPhone from Customer WHERE cCCCode='" + is_currNo + "' and cCusCode IN (select DWZD_DWBH from DATAMODEL.. BL_DWZD) "), the result is not correct

CodePudding user response:

Dw_1. Settransobject (sql_u8)

Dw_1. Setsqlselect (" select cCusCode cCusName, cCusAbbName, cDCCode, cCCCode, cCusAddress, cCusEmail, cCusPerson, cCusPhone from Customer WHERE cCCCode='" + is_currNo + "' and cCusCode IN (select DWZD_DWBH from DATAMODEL.. BL_DWZD)
")
Dw_1. Retrieve ()

Because it is in the data window to retrieve, such writing is not correct

CodePudding user response:

Establish a transaction to connect the DATAMODEL and then get a data window to retrieve the data (select DWZD_DWBH from DATAMODEL.. BL_DWZD) and then take out of the window for the select cCusCode, cCusName, cCusAbbName, cDCCode, cCCCode, cCusAddress, cCusEmail, cCusPerson, cCusPhone from Customer WHERE cCCCode='" + is_currNo + "' and cCusCode IN
Under such combinations
  • Related