qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.59k stars 3k forks source link

Select by (virtual layer) sql #35812

Open Jakob-Lanstorp opened 4 years ago

Jakob-Lanstorp commented 4 years ago

Feature description.

  1. Adding a "Select Features by SQL" menu in the Expression button.

  2. Adding a checkbox to the Virtual Layer dialog letting the user make a selection instead of a virtual layer (if SQL complies with a table select).

  3. Adding a pyqgis function selectBySQL('mysql') like iface.activeLayer().selectBySQL('mysql')

jmonticolo commented 4 years ago

If you make reference to the Select by expression Dialog, if it is to use only for SELECT, use the Select by expression dialog as the WHERE clause. For example :

"my_field_1" = 'transport' AND "my_id_field" < 100

Is there a particular SQL function in the Expression Dialog missing ?

Jakob-Lanstorp commented 4 years ago
  1. Ok, your right "select by expression" is like "select by where clause". Forget it.
  2. I still think from the Virtual layer dialog, it would be nice to just do a selection, instead of a new layer, if one clicks a 'Make selection instead of new layer' checkbox.