i have a problem with INNER JOIN.
Models
Job
User
UsersEvent
In my Job View i would like to get all users which are assigned to an event. I only get successfully the IDs from UsersEvent but not the names from the User Model.
In principle I would like to do following:
SELECT A.`id`,(CONCAT(A.vorname, ' ',A.nachname)) AS name FROM users AS A INNER JOIN users_events AS U ON A.id = U.user_id WHERE U.event_id = 2
But how i write it cake like ?
When i try it with
$this->Job->query("SELECT A.`id`,(CONCAT(A.vorname, ' ',A.nachname)) AS name FROM users AS A INNER JOIN users_events AS U ON A.id = U.user_id WHERE U.event_id = 2");
i get the complete array in my select field and can´t select a name.
Thanks for help
-- Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment