gpt4 book ai didi

mysql - 将 SELECT 查询从 mySql 转换为 Laravel 查询生成器

转载 作者:行者123 更新时间:2023-11-29 07:26:28 25 4
gpt4 key购买 nike

这个mysql查询的Laravel Query Builder代码是什么;

SELECT * 
FROM Student
WHERE family_id IN (SELECT family_id
FROM students
GROUP BY family_id
HAVING COUNT(1)>1)
ORDER BY family_id

最佳答案

$query = DB::select("SELECT * 
FROM Student
WHERE family_id IN (SELECT family_id
FROM students
GROUP BY family_id
HAVING COUNT(1)>1)
ORDER BY family_id")

基于 Laravel Documentation

关于mysql - 将 SELECT 查询从 mySql 转换为 Laravel 查询生成器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53453993/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com