私はこのmysqlコードの魔女が非常にうまく機能しています
SELECT uid , MAX(value) AS bidvalue FROM auction
WHERE pid = '$pid' and max_bid=0
GROUP BY uid
ORDER BY bidvalue DESC
LIMIT 1
このセレクションを users.id=auction.uid のユーザー テーブルと結合するにはどうすればよいですか?
ありがとうございました
ここには魔法は見られません:
SELECT uid, users.name, MAX(value) AS bidvalue
FROM auction
INNER JOIN users ON users.id = auction.uid
WHERE pid = '$pid' and max_bid=0
GROUP BY uid
ORDER BY bidvalue DESC
LIMIT 1
クエリが次のようになるように結合を使用できます
SELECT uid, users.name, MAX(value) AS bidvalue
FROM auction
INNER JOIN users ON users.id = auction.uid
WHERE pid = '$pid' and max_bid=0
GROUP BY uid
ORDER BY bidvalue DESC
LIMIT 1
また
SELECT uid, users.name, MAX(value) AS bidvalue
FROM auction
OUTER JOIN users ON users.id = auction.uid
WHERE pid = '$pid' and max_bid=0
GROUP BY uid
ORDER BY bidvalue DESC
LIMIT 1