Hello,
I am not getting the logic behind the sequence requested in the following:
SELECT carrier, id,
(SELECT COUNT(*)
FROM flights AS f
WHERE f.id < flights.id
AND f.carrier=flights.carrier) + 1
AS flight_sequence_number
FROM flights;
Can someone translates to me what does f.id < flights.id mean? and also f.carrier-flights.carrier
I do know what the result should be but I want to understand the logic if it was put in a sentance rather than a code, what would be?
(I think It could be something like: the id of the assigned f is less than the flights id, and the carrier of the assigned f = flights carrier)
Thanks