How to write a query in MySQL?

Please help in writing query to MySQL what we need:
There is a table with the goods purchased by the user and it has column "user_id" - which points to the user in another table with the list of users. So, you need a query to get the ID of the product that most customers buy a...
July 4th 19 at 23:32
1 answer
July 4th 19 at 23:34
Solution
select goodsid, count(1) cnt
 from goods
 where user_id = userid
group by goodsid
order by cnt desc 
limit 1
Bravo! - Vernon.Schu commented on July 4th 19 at 23:37

Find more questions by tags MySQLSQL