我有兩個表和一個查詢參考表。任何建議或幫助將不勝感激。mysql在兩個表中選擇
table1的
user_id username firstname lastname address
1 john867 John Smith caloocan
2 bill96 Bill Jones manila
table2中
user_name_id username firstname lastname address designation
1 jakelucas Jake Lucas caloocan employee
2 jadejones Jade Jones Quezon student
3 bong098 Bong Johnson pasig employee
參考表
ref_id username friend_username
1 tirso bill96
2 tirso jadejones
2 tirso bong098
輸出謹此
user_id user_name_id username firstname lastname address designation
2 bill96 Bill Jones manila
2 jadejones Jade Jones Quezon student
3 bong098 Bong Johnson pasig employee
+1查看設計而不是查詢 – edosoft 2009-11-30 13:08:58