我的整个查询与此子查询不同:
"(SELECT a.NumSeats From Aircrafts a WHERE f.AircraftID =a.AircrafID)"
我希望它返回一个数字,例如 5
当我选择一个整数 a.NumSeats 时,我不明白为什么这不起作用。
此查询还将返回 1 行的 MAX。
$subQuery1 = "(SELECT COUNT(*) from Seats s WHERE s.FlightID = f.FlightID)";
$subQuery2 = "(SELECT a.NumSeats From Aircrafts a WHERE f.AircraftID =a.AircrafID)";
$subQuery2 = 0;
$query = mysql_query("SELECT * FROM Flights f WHERE f.DeptAirport = '".$dep."' AND f.ArrAirport = '".$arr.
"' AND f.Date=STR_TO_DATE('".$depDate."', '%Y-%m-%d') AND ".$subQuery1. "=" .$subQuery2);
如果我删除 $subQuery2 = 0 它会中断