How to use a calculated column to calculate another column in the same view

后端 未结 5 747
故里飘歌
故里飘歌 2020-11-28 07:32

I am hoping you can help with this question. I am using Oracle SQL (SQL Developer for this view)...

If I have a table with the following columns:

  • Co
5条回答
  •  没有蜡笔的小新
    2020-11-28 08:32

    In Sql Server

    You can do this using cross apply

    Select
      ColumnA,
      ColumnB,
      c.calccolumn1 As calccolumn1,
      c.calccolumn1 / ColumnC As calccolumn2
    from t42
    cross apply (select (ColumnA + ColumnB) as calccolumn1) as c
    

提交回复
热议问题