IN
キーワードを使用するクエリがあります。これを zend select クエリに変換するにはどうすればよいですか?
これは生の SQL 形式のクエリです。
SELECT
rs_credit_score,
rs_fraud_score
FROM
provenir_instance_response
WHERE
application_number = @in_applcation_number
AND channel = @in_channel
AND final_decision_reason IN (
'Failed CallCredit Delphi ID Check',
'Failed Delphi KORules',
'Credit Score Cut Matrix Failure',
'Fraud Score Cut Matrix Failure',
'Teletrack Rule Failure'
そして、これが私がZendでこれまでに持っているものです:
public function scoreQuery($memId, $channel){
//Build Query
$select = $this->select();
$select->from('provenir_instance_response', array('rs_credit_score', 'rs_fraud_score'));
$select->where('application_number=?', $memId);
$select->where('channel=?', $channel);
$select->where('final_decision_reason IN Failed CallCredit Delphi ID Check');
$select->where('final_decision_reason IN Failed Delphi KORules');
$select->where('final_decision_reason IN Credit Score Cut Matrix Failure');
$select->where('final_decision_reason IN Fraud Score Cut Matrix Failure');
$select->where('final_decision_reason IN Teletrack Rule Failure');
$result = $this->fetchAll($select);
return $result;
}
それともこれ?
public function scoreQuery($memId, $channel){
//Build Query
$select = $this->select();
$select->from('provenir_instance_response', array('rs_credit_score', 'rs_fraud_score'));
$select->where('application_number=?', $memId);
$select->where('channel=?', $channel);
$select->where('final_decision_reason IN (
\'Failed CallCredit Delphi ID Check\',
\'Failed Delphi KORules\',
\'Credit Score Cut Matrix Failure\',
\'Fraud Score Cut Matrix Failure\',
\'Teletrack Rule Failure\'
)');
$result = $this->fetchAll($select);
return $result;
}
私はそれがこのようであるべきだと思いますか?
public function scoreQuery($memId, $channel){
//Build Query
$select = $this->select();
$select->from('provenir_instance_response', array('rs_credit_score', 'rs_fraud_score'));
$select->where('application_number=?', $memId);
$select->where('channel=?', $channel);
$select->where('final_decision_reason IN (?)', array(
'Failed CallCredit Delphi ID Check',
'Failed Delphi KORules',
'Credit Score Cut Matrix Failure',
'Fraud Score Cut Matrix Failure',
'Teletrack Rule Failure'
));
$result = $this->fetchAll($select);
return $result;
}
これは正しいですか、またはコードをどのようにリファクタリングしますか?
ありがとう
ネイサン:)