Pregunta

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     |
¿Fue útil?

Solución

It's as simple as:

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

Otros consejos

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"

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top