3

I have a polygon layer with 3 fields (A, B and C). I want to create a copy and add as a virtual layer so I use CREATE VIRTUAL LAYER option but only want the first field.

So I use the expression Select A from "polygon layer"

But it doesnt work. What is wrong with my expression? The fields only contain string values. Do I need to specify geometry column?

This expression works Select * from "polygon layer but takes all fields.

1 Answer 1

4

You forget the 4th field: geometry. It is not shown as a column, but it is there. If you do select * from layer, then in fact you call select geometry, A, B, C from layer.

So, if you want to load a copy of the original with only column 'A', you also have to call the geometry into the expression:

select geometry, A from layer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.