 |
จะให้ข้อมูลโชวหลายๆเทเบิ้ล ดูโค๊ตให้ผมหน่อยครับถูกไหม |
|
 |
|
|
 |
 |
|
Code
"SELECT * FROM member,scorep,scorepp,scoreppp,scorepppp,setpp INNER JOIN scorepscorep,scorepp,scoreppp,scorepppp,setpp as scorescorep,scorepp,scoreppp,scorepppp,setpp USING(UserID) WHERE UserID = '".$_SESSION['UserID']."' ";
Tag : PHP
|
|
 |
 |
 |
 |
Date :
2015-05-14 20:09:42 |
By :
Saharatza |
View :
667 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
การ join ตาราง ไม่ควร select * ครับ จะใช้ field ไหน ตารางไหนก็ใส่ไป
Code (PHP)
$sql = " SELECT
table1.field1,
table1.field2,
table1.field3,
table2.field1,
table2.field2,
table2.field3,
table3.field1,
table3.field2,
table3.field3,
FROM table1 as table1
INNER JOIN table2 as table2 ON table1.field1 = table2.field1
INNER JOIN table3 as table3 ON table1.field1 = table3.field1 // ใช้ field ไหนเทียบก็ว่าไป
WHERE table1.field1 = 2 // อะไรก็ว่าไป
";
|
 |
 |
 |
 |
Date :
2015-05-14 20:43:58 |
By :
randOmizE |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|