我想查詢有在對方的外鍵來顯示有條件的結果兩個表,我的表如下:PHP的MySQL如何運行以正確的方式子查詢該表
auction_bids表:
id applicant_id bid auction_id owner.id
拍賣表:
id user_id title description
結果我需要顯示給登錄的用戶是:
title applicant_id [how many bids the project has] auction_id
我現在不工作的查詢是:
SELECT (SELECT COUNT(auction_bids.owner_id)
FROM auction_bids
WHERE auction_bids.owner_id = ".$_SESSION['userid']."
) AS count, auction_bids.*
FROM auction_bids
WHERE auction_bids.owner_id = ".$_SESSION['userid']."
我不能讓每一個拍賣的出價次數在數據庫隨標題 謝謝
[不要忘記**採取SO遊**它會引導你如何最好地使用SO](http://stackoverflow.com/about) – Prix