从胖的数据中排除最后一个数据或行 - SQL查询

时间:2015-07-09 12:48:19

标签: php mysql

    SELECT * FROM time_slot JOIN reseve_slot ON reserv_start_time WHERE reserv_date = '09-07-2015' AND (time_slot NOT BETWEEN reserv_start_time AND reserv_end_time)

1 个答案:

答案 0 :(得分:0)

很难继续你的问题,但似乎你想要查询结果,因为它们是减去最后一个返回的行。

这是一个详细示例,清楚地显示删除:

$query = "select * from time_slot join reseve_slot on reserv_start_time where reserv_date = '09-07-2015' and (time_slot NOT between reserv_start_time and reserv_end_time)";
$result = mysqli_query($con, $query) or die($mysqli->error);
$resultArray = mysqli_fetch_assoc($result);

if (!is_null($resultArray)) {
    //remove the last result
    $wantedResult = array_pop($resultArray);

    // now do something with the returned results $wantedResult
}