+ 1
SQL question (homework)
Hello, I met a problem I'm not familiar with. I have a list of cars, which command should I use in order to find out the number of a car the oldest from my list? I have a commissioning date for each car. Thanks ahead.
1 Answer
+ 4
SELECT * FROM cars
WHERE Date=(SELECT MAX(Date) FROM cars)
retrive all records of cars table where those date are equal maximum date exist in cars table
if you want count retrived records
SELECT Count(Date) as CountOfCars FROM cars
WHERE Date=(SELECT MAX(Date) FROM cars)