Hi Rainer,
I am new to empire-db. The SQL below is what I would like empire-db to
generate.
select count(*)
from circuit_equipment
where circuit_with_attr_id in (select circuit_with_attr_id from
customer_circuit_impact
where item_id =
74006036);
I am seeing this from empire-db when I print out my DBCommand. I would like to
know why is empire-db adding the table CUSTOMER_CIRCUIT_IMPACT in the FROM
statement. The query below take a long time to run because of the extra table
that was added.
SELECT count(*)
FROM CIRCUIT_EQUIPMENT t6, CUSTOMER_CIRCUIT_IMPACT t7
WHERE t6.CIRCUIT_WITH_ATTR_ID IN ((SELECT t7.CIRCUIT_WITH_ATTR_ID
FROM CUSTOMER_CIRCUIT_IMPACT t7
WHERE t7.ITEM_ID=74006036))
Here is the code that produced the SQL above.
DBCommand impactCmd = db.createCommand();
impactCmd.select(
db.T_CUSTOMER_CIRCUIT_IMPACT.C_CIRCUIT_WITH_ATTR_ID );
addWhereClauseForType(impactCmd, idType, lID);
DBQuery CIRCUIT_WITH_ATTR_ID = new DBQuery(impactCmd);
DBCommand dbCmd = db.createCommand();
dbCmd.select( db.T_CIRCUIT_EQUIPMENT.count() );
dbCmd.where(
db.T_CIRCUIT_EQUIPMENT.C_CIRCUIT_WITH_ATTR_ID.in(CIRCUIT_WITH_ATTR_ID) );
Please help.
Thank You,
Chieu Nguyen
[email protected]