Reputation: 323
How to make this work in Zend...
select name, comment_id, text, date, number
from user, comment, telephone
where user.user_id = comment.user_id
and telephone.telephone_id = comment.telephone_id
and telephone.number = 000;
Thank you
Upvotes: 0
Views: 93
Reputation: 2643
I'm not sure about which column belongs to which table but it is quite simple to change it if I made a mistake. The query in Zend could be written like this :
$select = $db->select();
$select->from('user', array('name'));
$select->join('comment', 'user.user_id = comment.user_id', array('comment_id', 'text', 'date'));
$select->join('telephone', 'telephone.telephone_id = comment.telephone_id', array('number'));
$select->where('telephone.number = ?', '000');
I suggest you to read the documentation to be able to build select queries easily.
Upvotes: 1