Correlated Subqueries II


#1


I'm currently working on Correlated Subqueries II. The exercise seems trivially simple, since the example given is so close to the solution, but I'm not having any luck getting it correct. I get a table without errors that looks like it fulfills all the requirements of the solution, but I get the error message

"Find the origin, flight id, and sequence number."

Code follows:

SELECT origin, id,
	(SELECT COUNT(*)
   FROM flights f
   WHERE f.id < flights.id
   AND f.carrier=flights.carrier)+1
   AS flight_sequence_number
   FROM flights;

Am I missing something silly, or is this a bug?


#2

We are accessing the origin column, not carrier.

AND f.origin=flights.origin) + 1

#3

Ok, thanks. The problem statement only says to list by origin, not that the sequence numbers should be re-evaluated on a per-origin basis.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.