<code>$res = DB::table('topics')->select('topics.*', 'b.username',
'b.avatar', 'c.username as rname', 'd.cname')
->where('topics.is_hidden', 0)
->leftJoin('users b', 'b.uid', '=', 'topics.uid')
->leftJoin('users c', 'c.uid', '=', 'topics.ruid')
->leftJoin('nodes d', 'd.node_id', '=', 'topics.node_id')
->orderBy('ord', 'desc')
->take($limit)->get();
</code>这里错误很多:
table 'startbbs.stb_users b' doesn't exist
stb_users 我要用到两次,肯定得取别名,怎么办呢
<code>$res = DB::table('topics')->select('topics.*', 'b.username',
'b.avatar', 'c.username as rname', 'd.cname')
->where('topics.is_hidden', 0)
->leftJoin('users b', 'b.uid', '=', 'topics.uid')
->leftJoin('users c', 'c.uid', '=', 'topics.ruid')
->leftJoin('nodes d', 'd.node_id', '=', 'topics.node_id')
->orderBy('ord', 'desc')
->take($limit)->get();
</code>这里错误很多:
table 'startbbs.stb_users b' doesn't exist
stb_users 我要用到两次,肯定得取别名,怎么办呢
<code class="php">$res = DB::table('topics')->select('topics.*', 'b.username',
'b.avatar', 'c.username as rname', 'd.cname')
->where('topics.is_hidden', 0)
->leftJoin('users AS b', 'b.uid', '=', 'topics.uid')
->leftJoin('users AS c', 'c.uid', '=', 'topics.ruid')
->leftJoin('nodes AS d', 'd.node_id', '=', 'topics.node_id')
->orderBy('ord', 'desc')
->take($limit)->get();</code>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号