2

I have a problem with QGIS 3.4.12. As you can see in the image below, it's not possible to execute queries using query builder, because there's always a syntax error. This only happens using this layer ("benigeo"). How can I solve this issue?

enter image description here

EDIT: I need to select the list of some attributes, for this reason I don't need a WHERE clause. To be more clear, I attach another screenshot where you can see what I need. In this layer ("waterways") I'm able to SELECT the waterways type list. Instead, in the other layer I have always that error.

enter image description here

4

You dont need to input the SELECT * FROM benigeo as it's implicit in the context of the provider filter query builder. But you need to add a WHERE clause (without actually inputting the WHERE, only the condition) to select something.

EDIT

It seem that you are misusing the provider filter query builder, it's purpose is to filter a layer (ie. only fetching a subset from the provider) based on a WHERE close on the attribute. (as the query are evaluated by the provider you may get different result with different provider, that could explain why some of your test work while other dont)

If you want to use more advanced SQL query (as in your exemple) you probably should use a virtual layer (Layer > Add Layer > Add/Edit Virtual Layer..., use the import button to load your layer and type your query (in full this time) in the query box) as this rely on SQlite/Spatialite you should get more consistant result.

| improve this answer | |
  • Hi, thanks! In this case I have no errors, but still I have a problem. I'm going to edit my post to be more clear – Lorenzo Jan 28 at 16:45
  • Thanks, I think virtual layers could solve my problems – Lorenzo Jan 28 at 19:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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