<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>
Hier gibt es viele Fehler:
Tabelle 'startbbs.stb_users b' existiert nicht
stb_users Ich möchte sie zweimal verwenden, also muss ich einen Alias verwenden, was soll ich tun?
<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>
Hier gibt es viele Fehler:
Tabelle 'startbbs.stb_users b' existiert nicht
stb_users Ich möchte sie zweimal verwenden, also muss ich einen Alias verwenden, was soll ich tun?
<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>