close
Blogtrottr
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 已解決
Yahoo!奇摩知識+ - 分類問答 - 電腦網路 - 已解決 
LSAT prep from HLS-educated instructors

LSATMax includes video lessons, unlimited personal attention & support, and over 6,000 real questions from previous LSAT’s. Enroll for just $299.
From our sponsors
left join 的疑問... 太難了拉,頭好痛喔~~
Jan 13th 2014, 09:12

建了3個資料表
1.member
欄位
MemberID
Name(EX.靜香,大雄....)

2.service
欄位
ServiceID
ServiceType(EX.Web,Email)
Name(EX.網站服務,電子郵件服務)

3.rt_member_service
欄位
rt_member_serviceID
MemberID
ServiceID

我想顯示出(舉例):

靜香 - Web - 網路服務
靜香 - Email - 電子郵件服務
大雄 - Email - 電子郵件服務

類似這樣的..

下面是我打的

$sql="select * from rt_member_service left join member on rt_member_service.memberID = member.memberID";
$Rs=mysql_query($sql);
while ($Row = mysql_fetch_array($Rs))
{

$sql="select * from rt_member_service left join service on rt_member_service.serviceID = service.serviceID";
$R=mysql_query($sql);
while ($Roow = mysql_fetch_array($R))

echo $Row[Name] . " - " . $Roow[ServiceType] . " - " . $Roow[Name] ."</br>";
}

只是結果變成這樣(舉例)

靜香 - Web - 網路服務
靜香 - Email - 電子郵件服務
靜香 - Web - 網路服務
靜香 - Email - 電子郵件服務
靜香 - Web - 網路服務
靜香 - Email - 電子郵件服務
大雄 - Email - 電子郵件服務
大雄 - Email - 電子郵件服務

重複了很多很多次,我不知道為什麼,是不能用雙重迴圈嗎

求解...

SQL新手向各位大大發問
我實在不知道哪裡出錯了= =

This entry passed through the Full-Text RSS service — if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers.

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 yhiysbv 的頭像
    yhiysbv

    海霸王年菜2016 , 台酒年菜2016 , 外帶年菜2016 , 飯店年菜2016 , 素食年菜2016 , 高雄年菜2016 , 阿霞飯店年菜2016 (年菜菜單)2016年菜預購 高雄年菜餐廳 ... 2016

    yhiysbv 發表在 痞客邦 留言(0) 人氣()