我的整个查询与此子查询不同:
"(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则会中断
答案 0 :(得分:1)
我认为a.AircrafID
应为a.AircraftID
。