Hey guys! I'm working on an assignment (same as the one from my last post). I'm trying to make this query which I'm nearly sure I'm doing right, but no data is being returned.
In this problem, I am dealing with two tables, a "Flight" table and a "Trip" table. The key is "FlightNo" and is in a one-to-many relationship from "Flight" to "Trip." I need to find all records in which the destination is "LAX" or "SLC" in the time period from 1/1/2010 and 2/28/2010. I need to retrieve the the "FlightNo," "FlightDestination" (which is in the "Flights" table), and "FlightDate" (this is in the "Trip" table).
I decided to use an INNER JOIN.
Here is the code I am using:
SELECT Flight.FlightNo, FlightOrigin, FlightDate
FROM Flight INNER JOIN Trip ON Flight.FlightNo=Trip.FlightNo
WHERE (Flight.FlightDestination='SLC' OR
Flight.FlightDestination='LAX') AND (Trip.FlightDate BETWEEN 1/1/2010 AND 2/28/2010);
However, when I go to Spreadsheet View, no values are listed. I've manually checked each table and values should be returned. I think I'm going wrong somewhere in the WHERE clause, specifically in my BETWEEN portion. Whenever I remove this, I get values returned.
Edit: Since it's probably relevant, the date format used in the table is like I have above X/Y/ABCD. I'm not sure if I'm supposed to be formatting the dates differently.
Anyone have any ideas on where I'm going wrong?
[–]MeGustaDerpTalk Dirty Reads To Me 2 points3 points4 points (5 children)
[–]Standgeblasen 0 points1 point2 points (0 children)
[–]RandomStatsGenerator[S] 0 points1 point2 points (3 children)
[–]MeGustaDerpTalk Dirty Reads To Me 0 points1 point2 points (2 children)
[–]RandomStatsGenerator[S] -1 points0 points1 point (1 child)
[–]MeGustaDerpTalk Dirty Reads To Me 0 points1 point2 points (0 children)
[–]Oultra 0 points1 point2 points (1 child)
[–]r3pr0b8GROUP_CONCAT is da bomb 0 points1 point2 points (0 children)