The population estimates layer (
COUNTY fields with state and county FIPS codes, like this:
The county boundary (
cb_2018_us_county_5m) layer contains the same values but with slightly different formatting and additionally a
GEOID string field that combines the two:
QGIS doesn't support joining on multiple fields, but a common workaround is to create a new virtual field that combines the target attributes. I want to create a virtual field in the population layer that matches the
GEOID field in the county boundary layer.
This would be simple if there were a function equivalent to
sprintf, because then I could just write:
sprintf('%02s%03s', "STATE", "COUNTY")
...but as far as I can tell, no such function exists. What's the best way to handle this?