Hello, question on sql. There are 2 tables in the database. likes and servers . I made a request that should sort the records from servers by the number of likes they set from the likes table (each rating as a separate record in the table, not as a number). Everything works great, except for the moment when a record from the servers does not have a single rating in the corresponding table with ratings, this record is simply not displayed. I'm not saying that the following code should take such a record into account, I just don’t know how to implement it, because not strong in sql.
Here is the query (for formatting the query itself, do not worry, I use ORM and it requires similar syntax):
select s.id, l.target, count(*) as marks from servers s inner join likes l on l.target = s.id group by s.id order by marks
I would be grateful for any help.
ORDER BY marks DESCorASC- whereDESCis from major to minor, andASCfrom minor to major. - And