When I try a simple query
SELECT "Water_Service_Area_Boundaries_Non_Cadastral"."Network", count(*), sum(st_length(geometry))
FROM "W_Mains_DSC_ExclAbandoned", "Water_Service_Area_Boundaries_Non_Cadastral"
WHERE ST_Intersects("Water_Service_Area_Boundaries_Non_Cadastral", "W_Mains_DSC_ExclAbandoned")
GROUP BY "Water_Service_Area_Boundaries_Non_Cadastral"."Network"
I get this error
Query preparation error on PRAGMA table_info(_tview): ambiguous column name: geometry
When I try it without the st_length
it works to create a simple group with counts.
Also just the following works fine
Select sum(st_length(geometry)), count(*)
From W_Mains_DSC_ExclAbandoned
Examples of the subset of the query that work independently but not when strung together
Just the total length
Just the group
When I simply add the st_length
I have tried with .geometry in the ST_Intersects
and this gives correct counts but gives the pragma geometry error when the sum is added
geometry
. You need to specify which geometry column you want to performST_length()
on. Just like you specified the table for theNetwork
column