2
1. payment(user_id, calculation_id)
2. user(id, user_name)
3. calculation(id, period_start_date, period_end_date)

I need to select payments with user_name, period_start_date, period_end_date. How can I do it within one query in Zend Framework?

Thanks a lot.

1 Answer 1

11

I have found the solution:

$db     = new Zend_Db_Table('payment');
$select = $db->select()->setIntegrityCheck(false);
$select->from('payment')
       ->join('user', 'user.id = payment.user_id', array('user_name'))
       ->join('calculation', 'calculation.id = payment.calculation_id', array('period_start_date', 'period_end_date'));

$payment = $db->fetchAll($select)->toArray();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.