I'm using SQL Server and creating a script which will get the workers geographical location out of my database. The script is below.
SELECT w.display_name, w.geo_location
FROM jobs j WITH(NOLOCK)
INNER JOIN workers w WITH(NOLOCK) ON w.worker_id = j.worker_id
WHERE .....
The problem is that I want to add GROUP BY w.display_name, w.geo_location
to the script as there are duplicate records being shown. Added a column with the data type geography to a group by clause causes an error to be thrown.
The error being thrown when I add this in is:
The type "geography" is not comparable. It cannot be used in the GROUP BY clause.
Is there a way around this? I cannot convert w.geo_location
to a VARCHAR
as it is needed in the geography data type.