0

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

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

4 Comments

Yes, this is correct, I check in documentation and it is works. Thank You.
I got another question to you, there is possible to build this query on different way?
@Marcin What a different way means? is Zend_Db_Statement means a different way for you? Tell me more about what you need exactly.
My Application is very slow and I think problem is with DB and I want to find the way to speed up DB.

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.