我们如何在 Laravel 中使用自加入

  • 本文关键字:Laravel 我们 laravel-4
  • 更新时间 :
  • 英文 :

SELECT name, email, users.password
FROM users
INNER JOIN(
SELECT password
FROM users
GROUP BY password
HAVING COUNT(password) >1
)temp ON users.password= temp.password
where email = 'Excep@yesbus.com';

转换这个 laravel 查询版本,我尝试了这种方法,但看到找不到错误基础视图

User::select('user_id, name, type, email, username, password')
->join('temp', 'users.password', '=', 'temp.password')
->groupBy('password')   
->having('password', '>',1)
->where('email', Input::get('username'))
->get();
tried this does not work can anyone please suggest how we can do this thanks in advance

尝试这种方式可能会对您有所帮助

$email = Input::get('username');
$users = DB::select( DB::raw("SELECT name, email, username, users.password FROM users INNER JOIN( SELECT password FROM users GROUP BY password HAVING COUNT(password) >1 )temp ON users.password= temp.password where email = '$email'") );

相关内容

  • 没有找到相关文章

最新更新