简要:
我试图联合2个表recipes,posts然后添加->paginate(5)到查询.
但由于某种原因,我得到了这个错误:
基数违规:1222使用的SELECT语句具有不同的列数(SQL :(选择count(*)作为聚合来自
posts
码:
$recipes = DB::table("recipes")->select("id", "title", "user_id", "description", "created_at")
->where("user_id", "=", $id);
$items = DB::table("posts")->select("id", "title", "user_id", "content", "created_at")
->where("user_id", "=", $id)
->union($recipes)
->paginate(5)->get();
Run Code Online (Sandbox Code Playgroud)
难道我做错了什么?
没有->paginate(5)查询工作正常.