Click here to Skip to main content
15,867,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Select EPA.tax_year, EP.house_number + ' ' + EP.street_name 'Property Addres', EPA.assessed_value "Assessed Value"
from EdmontonPropertyAssessment EPA
		Inner Join EdmontonProperty EP
			On EPA.account_number = EP.account_number
Where EPA.tax_year = '2022' and EPA.assessed_value = MAX(assessed_value)


What I have tried:

When I removed the EPA.assessed_value it's printing all of the year 2022 what i'm trying to do is select the highest assessed value in year 2022. It is for homework and I just need to use subquery in order to answer it
Posted
Updated 16-Mar-23 10:44am

1 solution

The error message is pretty explicit: you can't use an aggregate in a WHERE clause without a GROUP BY function with a HAVING clause: SQL HAVING Clause[^]

Me? I'd split is and select the MAX value into a variable, then use the variable in the comparison - it would also be a lot more efficient!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900