Hello. Please tell me what is the difference between requests: this
select count(*) from `drivers` where `user_id` = 1 and (`way1` = 25 or `way2` = 25 or `way3` = 25) and `travel_date`>1442682000 here I counted out the last 10 lines in the database and from the 11th one I took travel_date , and by this
select count(*) from `drivers` where `user_id` = 1 and (`way1` = 25 or `way2` = 25 or `way3` = 25) order by `travel_date` desc limit 10 You need to select the count for the last 10 drivers (dates (travel_date) go in ascending). The first query selects everything correctly, but the fact is that it does not suit me, because to calculate the condition ( travel_date > 1442682000), you need to be very confused. I wanted to remake the request without this condition, I got the second option. But he gives the wrong answer. The correct answer is 3, but it gives out 181. Tell me why so?
SELECT COUNT(*) FROM (SELECT * FROM travel_date LIMIT 10) AS tmp- VismanSELECT COUNT(*) FROM (SELECT * FROMdrivers` whereuser_id= 1 order bytrawel_datedesc LIMIT 10) as tmp where (way1= 25 orway2= 25 orway3= 25) ` - Konstantin