所以基本上,我有 2 个表,我需要得到一列的总和。但是我需要选择的行在另一个表中有标准。我想出了这个查询,但它总是返回空值。
SELECT sum( secondary_lpt.loan_amount )
FROM secondary_lpt
LEFT JOIN loan_log ON loan_log.loan_guid = secondary_lpt.loan_guid
WHERE (
secondary_lpt.lock_Date
BETWEEN date( '2013-02-19 15:25:55' )
AND date( '2013-04-19 15:25:55' )
)
AND (
loan_log.loan_ms_funding = NULL
OR loan_log.loan_ms_funding = ''
)
AND (
loan_log.loan_transdetail = 'Active Loan'
)
我很难说出我想说的话,所以我想这可能是问题的一部分。