I am using QGIS 3.10 to make simple queries using the "Filter" and "Select by Expression" tools. I have a layer with cities/towns in New York State with population attributes, e.g. "POP1990"
is population in 1990, "POP2010"
is population in 2010, etc.
Certain queries seem to work in one tool but not the other. For example, I want to select all towns/cities in New York State where the population increased by more than 5% from 1990 to 2010. Oddly (to me) when I make all references to an attribute/field name lowercase, the "Select by Expression" tool works, but when I spell the attribute/field name with the correct case and put it in double quotes it does not work.
Below are the expressions I write, the tool I use, and the outcome:
Tool: "Select by Expression"
Expression: ( "POP1990" * 1.05 ) < "POP2010"
Outcome: doesn't work - selects all features
Tool: "Filter"
Expression: ( "POP1990" * 1.05 ) < "POP2010"
Outcome: doesn't work - all features remain
Tool: "Select by Expression"
Expression: ( pop1990 * 1.05 ) < pop2010
Outcome: WORKS CORRECTLY - 469 out of 994 features selected
Tool: "Filter"
Expression: ( pop1990 * 1.05 ) < pop2010
Outcome: doesn't work - all features remain
I could give other examples of different expressions working or not working.
Data are downloadable below as a link, if you would like to test it yourself. (This is my first Stack Exchange post, by the way.)
Here is the New York State cities/towns shapefile layer for download.