Question

I used to know how to do this, but I can’t seem to remember or find the answer.

I want to return data from a table and then just add an extra column with a set value (which does not need to be saved). So, it is not an UPDATE issue. Just a SELECT with that extra column.

Original table:

|  id  |   col1   |   col2   |
|  1   |  value1  |  value2  |

Return something like this:

|  id  |   col1   |   col2   ||    tmpCol    |
|  1   |  value1  |  value2  ||    12:48     |
Was it helpful?

Solution

It's as simple as:

SELECT id, col1, col2, '12:48' AS tempCol

OTHER TIPS

use this

select id,col1,col2, '12.48'  as tempcol

try this. alter table TableName add column columnName date ; note, put the exact table name in the "TableName that i defined" that u want to add the column and put the column name where i defined the "columnName"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top