I am very new to PHP and SQL and am putting together my first project for hockey statistics. I have searched this great site many times to work through my issues but this one has me stumped.
I am looking to create a SQL query to rank hockey leaders based on goals scored.
For this particular one I am trying to take a table in my database with Team Id
, and Goals For
where the teams have a League Id
= 0 and RANK the Goals For column. Everything I have come up with on the internet leads to a SQL error. Any help is greatly appreciated and since this is my first post, if I am lacking information needed to answer this let me know.
I have tried the following query with no luck.
SELECT
League Id
, Team Id
, Goals For
,
RANK () OVER (ORDER BY Goals For
DESC) GF
FROM
team_records
WHERE League Id
= 0;
pimpinhockey is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.