Rank using a left join of another table data.
The app has tokens where the users can vote on. I want to be able to display the rank of each token in the app... The final objective is to create a MySQL view the query, but when trying to create the query I ran into some errors... I am unable to find what is wrong...
The query:
SELECT a.id,a.name,a.symbol, a.logo, a.market_cap, a.price
, a.launch_date, a.email, a.description, a.contract_bsc, a.contract_eth
, a.contract_poly, a.link_website, a.link_telegram, a.link_twitter, a.promoted
, a.status, a.date, COUNT(b.date) as 'votes'
, rank() OVER ( partition by a.id order by 'votes' desc ) AS token_rank
FROM `tokens` a
LEFT join votes b
on a.id=b.token_id;
My Ultimate goal is to create a view where I can make search queries from it...