Answers for "how to to find the diffrerence between two values in SQL"

SQL
0

the differnece between to values in sql

SELECT 	
city,
	year,
      population_needing_house,
      LAG(population_needing_house)
      OVER (PARTITION BY city ORDER BY year ) AS previous_year
      population_needing_house - LAG(population_needing_house)
 	OVER (PARTITION BY city ORDER BY year ) AS difference_previous_year
FROM 	housing
ORDER BY city, year
Posted by: Guest on July-01-2021

Code answers related to "how to to find the diffrerence between two values in SQL"

Code answers related to "SQL"

Browse Popular Code Answers by Language