in core php we are using query like this:
SELECT * FROM users
INNER JOIN registration ON users.id=registration.id WHERE users.id='7’
how can write in Cakephp 3.6.7
thanks & regards,
Darshan
in core php we are using query like this:
SELECT * FROM users
INNER JOIN registration ON users.id=registration.id WHERE users.id='7’
how can write in Cakephp 3.6.7
thanks & regards,
Darshan
anyone write for that above query…?
You should read the doc you can also do it with the connection manager as well:
public function customQueryManager()
{
$c = ConnectionManager::get('default');
return $c
->query(
"SELECT * FROM users INNER JOIN registration ON users.id=registration.id WHERE users.id=7")
->fetchAll('assoc');
}
or by using join with the querybuilder
i am using like this
$query1 = TableRegistry::get(‘users’)
->find()
->join(
[
‘table’ => ‘registration’,
‘type’ => ‘INNER’,
‘conditions’ => [
‘registration.id’ => ‘users.id’,
‘users.id’ => 1
]
]
);
in that above query using in controller and how to call to design…?
any suggestion…?
in that above code will written in controller right…?
i am not getting…