add a temporary column with a value

前端 未结 6 1526
萌比男神i
萌比男神i 2021-01-31 07:35

I have a select statement like this

select field1, field2  
  from table1

What I want is to have a newfield with only value \"example\".

<
6条回答
  •  猫巷女王i
    2021-01-31 08:06

    I giving you an example in wich the TABLE registrofaena doesn't have the column called minutos. Minutos is created and it content is a result of divide demora/60, in other words, i created a column to show the values of the delay in minutes.

    This is the query:

    SELECT idfaena,fechahora,demora, demora/60 as minutos,comentario 
    FROM registrofaena  
    WHERE fecha>='2018-10-17' AND comentario <> '' 
    ORDER BY idfaena ASC;
    

    This is the view:

提交回复
热议问题