Created
February 9, 2023 05:26
-
-
Save cliftonlabrum/71dd24e3ad581e028d05494a59684d82 to your computer and use it in GitHub Desktop.
HAVING a Hard Time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
date, year, month, day, duration, departure, departureName, destination, destinationName, departureTime, destinationTime, route, landingsDay, landingsNight, distance, remarks, signatureId, | |
flight.id AS id, | |
flight.aircraftId AS aircraftId, | |
flight.trashed AS trashed, | |
aircraft.registration AS aircraftRegistration, | |
aircraft.makeModel AS aircraftMakeModel, | |
aircraftCategory.name AS aircraftCategoryName, | |
field.name, | |
value.time, | |
value.boolean | |
FROM flight | |
LEFT JOIN aircraft ON flight.aircraftId = aircraft.id | |
LEFT JOIN aircraftCategory ON aircraftCategory.id = aircraft.aircraftCategoryId | |
LEFT JOIN value ON value.flightId = flight.id OR value.aircraftId = flight.aircraftId | |
LEFT JOIN field ON field.id = value.fieldId | |
WHERE | |
flight.trashed = 0 | |
$whereSearch | |
$whereYear | |
${filter.where} | |
GROUP BY | |
flight.id | |
HAVING | |
${filter.having} | |
ORDER BY | |
year DESC, month DESC, day DESC, departureTime DESC, flight.modified DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment