08-21-2019 06:36 AM
Hi there,
I am trying to use aliases for the column names of my query results in desktop application.
Therefore I want to use "AS" in my SQL statement but the results are not renamend.
For example when I use the follwing query:
SELECT id, gemeinde AS Gemeinde, strassenname AS Strasse, hausnr AS Hausnummer FROM alkis_gebaeude
the result is still
gemeinde / strassenname / hausnr
I think the desktop client does not support this.
Hint: The query itself works fine and delivers the results, also in studio I get a "valid query" when I check the statement.
Can anyone confirm this?
Is it a bug?
Thanks
Stefan
Solved! Go to Solution.
08-21-2019 06:42 AM
Hi Stefan,
That is strange, it works fine for me, except the action button which has wrong caption (there's bug filled for that):
My query
SELECT ID1, ZONE, EVT_DATE AS Date, REPORT_URL as "{ACTION.browse(urlTemplate)}" FROM Crime WHERE ID1 = {ENTITY.ID1}
Results:
08-21-2019 07:03 AM
Hi Jan,
thank you for your reply.
Here is the whole SQL I am using (with input):
SELECT id, gemeinde AS Gemeinde, strassenname AS Strasse, hausnr AS HausNr, nutzung AS Nutzung, klasse AS Klasse, qualitaet_herkunft AS Qualität, o_name AS Name FROM alkis_gebaeude WHERE LOWER(strassenname) LIKE LOWER({ENTITY.%strassenname%}) AND hausnr LIKE {ENTITY.%hausnr%} ORDER BY gebkennzeichen ASC
and my result attached.
I am using the latest version of MAE: 16.5.959.3
Can you please test what's happening if you use a placeholder?
08-21-2019 07:06 AM
Note: I am using postgres!
08-21-2019 07:08 AM
I used MSSQL in the test. I will check with PostgreSQL...
08-21-2019 07:20 AM
I think I got it, please use double-quoted names when naming columns in PostgreSQL. Otherwise, the engine will automatically lower-case the column names. Example:
SELECT row_id, objektart as "Objekt Art", oid as "Object ID" FROM mytable;
08-21-2019 11:28 PM
Hi Jan,
thank you for your answer! It's the solution - works fine now!
Regards
Stefan