Is there a way to run a sql query and fetch three columns from a table and at the same time append two predefinied columns that doesn´t come from any table?
Let´s say that I would like the result to look someting like this:
ID, Firstname, Lastname, Predefinedvalue_1, Predefinedvalue_2
0, Donald,Duck, 0, 5
1, Mickey, Mouse, 0, 5
2, Minnie, Mouse, 0, 5
So value 1 should always be 0 and value 2 should always be 5 and these values doesn´t exist in any table.
SELECT ID, Firstname, Lastname, 0 AS Predefinedvalue_1, 5 AS Predefinedvalue_2
FROM myTable
Any literal value like 0 or 5 can be listed in the SELECT clause, and given an alias using the AS keyword, followed by the desired alias name. Strings and dates need to be enclosed in single quotes:
SELECT ID, Firstname, Lastname, 0 AS Predefinedvalue_1, 5 AS Predefinedvalue_2, 'Hello, World!' AS myNewColumn
FROM myTable