Oracle sqlplus 12c查询错误

时间:2018-04-03 02:58:37

标签: database oracle sqlplus

Airport(Airport, AName, CheckIN, Resvtns, FlightInfo)
Route(RouteNo, RDescription)
Fares(FareType, Fdescription, Conditions)
Tariff(RouteNo , FareType, Price)
Aircraft(AircraftType, ADescription, NoSeats)
Flight(FlightNo, FromAirport, ToAirport, DepTime, ArrTime, Service, AircraftType, RouteNo)
Passenger(Pid, Name, Address, TelNo)
Ticket(TicketNo, TicketDate, PID)
Itinerary(TicketNo, FlightNo, LegNo, FlightDate, FareType)

嗨,有人可以帮我修复此查询吗?错误写在下面。

列出至少两张票的乘客姓名,每张票价超过180英镑。

SELECT Name 
FROM Passenger 
WHERE Pid IN (SELECT p FROM (SELECT Pid AS p,count(*) AS c FROM Ticket
GROUP BY PID HAVING count(*) >1) AS tic);

错误:缺少右括号第4行

1 个答案:

答案 0 :(得分:0)

您的查询应该只是

SELECT name
FROM   passenger
WHERE  pid IN (SELECT pid
               FROM  Ticket
               GROUP  BY pid
               HAVING Count(*) > 1);