[Qgis-user] DB Manager query: Can't get CASE WHEN to work

Bernd Vogelgesang bernd.vogelgesang at gmx.de
Sat Dec 7 09:47:35 PST 2019


Hi,

maybe it's again some strange local issue, but I can't find a way to make CASE WHEN working in a DB Manger query or in a Vitual Layer.

The example is analog to https://www.sqlitetutorial.net/sqlite-case/
I would like to populate a new column "category" in that select

SELECT *

CASE WHEN status = 'v' THEN 'v'

	ELSE 'nv'

END category

FROM

table;

Whatever I try, the result is always a:

near "CASE": syntax error

This should have been the preparation for a much more complex query, but I even fail at the start :(

Any ideas whats wrong?

Cheers,

Bernd

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20191207/105ac6c8/attachment.html>


More information about the Qgis-user mailing list