在一个关键项上使用多个表内连接。无法弄清楚出了什么问题

时间:2022-04-13 01:27:16

For the life of me I can not figure out where I have went wrong I am pulling the data from these multiple tables but no data appearing

对于我的生活,我无法弄清楚我哪里出错我从这些多个表中提取数据但没有出现数据

$result=mysql_query("SELECT * FROM chars uc
INNER JOIN zone_settings t ON uc.pos_zone = t.zoneid    
INNER JOIN char_look v ON uc.charid = v.charid  
INNER JOIN char_jobs y ON uc.charid = y.charid  
INNER JOIN char_stats n ON uc.charid = n.charid     
INNER JOIN char_profile p ON uc.charid = p.charid 
WHERE `accid`='".$user["id"]."' ORDER BY `charid`");

Thanks kwolfe using LEFT JOIN and Removing the ORDER BY it works now. Here is the code.

感谢kwolfe使用LEFT JOIN并删除ORDER BY它现在可以正常工作。这是代码。

$result=mysql_query("SELECT * FROM chars uc
LEFT JOIN zone_settings t ON uc.pos_zone = t.zoneid     
LEFT JOIN char_look v ON uc.charid = v.charid   
LEFT JOIN char_jobs y ON uc.charid = y.charid   
LEFT JOIN char_stats n ON uc.charid = n.charid  
LEFT JOIN char_profile p ON uc.charid = p.charid 
WHERE `accid`='".$user["id"]."'");

1 个解决方案

#1


0  

Switch to LEFT JOINS to see if your missing a relationship along the way (INNER JOIN will only show data where a relationship is made for each table, in this case ALL tables.)

切换到LEFT JOINS以查看您是否遗漏了一段关系(INNER JOIN将仅显示为每个表建立关系的数据,在本例中为所有表。)

#1


0  

Switch to LEFT JOINS to see if your missing a relationship along the way (INNER JOIN will only show data where a relationship is made for each table, in this case ALL tables.)

切换到LEFT JOINS以查看您是否遗漏了一段关系(INNER JOIN将仅显示为每个表建立关系的数据,在本例中为所有表。)