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

2019-12-07 Thread Bernd Vogelgesang

Ok, sorry for the noise!
comma missing after select *

SQL and me not going to be good friends

Cheers,
Bernd

Am 07.12.19 um 18:47 schrieb Bernd Vogelgesang:

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



___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

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

2019-12-07 Thread Bernd Vogelgesang

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

___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user