add a temporary column with a value

前端 未结 6 1518
萌比男神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条回答
  •  鱼传尺愫
    2021-01-31 07:57

    You mean staticly define a value, like this:

    SELECT field1, 
           field2,
           'example' AS newfield
      FROM TABLE1
    

    This will add a column called "newfield" to the output, and its value will always be "example".

提交回复
热议问题