SELECT … FROM … WHERE … ORDER BY order_date DESC LIMIT 3
Where order_date is the name of the column indicating the date. You didn’t specify column names, so you should substitute order_date with your own column date
For future reference, it always good to add the result(s) of SHOW CREATE TABLE query/queries of all tables involved in your question to your post, so we can understand the problem better
I feel stupid not realizing the DESC, whihc made all the difference. I was using just before I posted order by fieldname limit 1, which showed the first record. I thank you nevertheles.
Another related question is that I have many countries in the country column indicating where the order was placed from. for example, US is recorded in 8 times and UK 6 and Sweden 3. In other words, I have 8 occurances of USA and 6 of UK and so on. How can I simply say like…8 times were ordered from USA and 6 times from UK and so on and forth?
I have one question. The result of the SQL above is as follows:
country | howmany
Russian Federation 5
Sweden 1
United Kingdom 7
United States 4
Is it possible to order it by the column howmany? In other words, the result starts with UK and Russia second and USA third and so on. I tried order by howmany but it added up to one number. And Group by howmany returns an error.
Thanks Risoknop. Your solution worked ok but it showed the results the other way around. That is, to say the country with the most orders was at bottom while the country with the least numbers of orders were at top. I wanted the reverse. But I just added the keyword DESC at the end and it fixed the problem.