左连接和外连接之间的区别是什么。可以用示例解释任何一个??
答案 0 :(得分:1)
没有区别:$select_folder = mysqli_query($conn, "select * from folder where p_folder_id='0'");
while ($row_folder = mysqli_fetch_array($select_folder)) {
echo $row_folder['name']."<br>";
$select_p_folder = mysqli_query($conn, "select * from folder where p_folder = '".$row_folder['id']."'");
if (mysqli_num_rows($select_p_folder) > 0) {
while ($row_p_folder = mysqli_fetch_array($select_p_folder)) {
echo "-".$row_p_folder['name']."<br>";
$select_next_folder = mysqli_query($conn, "select * from folder where p_folder = '".$row_p_folder['id']."'");
if (mysqli_num_rows($select_next_folder) > 0) {
while ($row_next_folder = mysqli_fetch_array($select_next_folder)) {
echo "--".$row_next_folder['name']."<br>";
}
}
}
}
}
是外部联接。
left join
也是一个外部联接,但我从未见过用过商业用途。