Invalid column name error in WHERE clause, column selected with CASE

后端 未结 4 1332
青春惊慌失措
青春惊慌失措 2020-12-20 16:09

I have a (rather complicated) SQL statement where I select data from lots of different tables, and to cope with a bad legacy data structure, I have a couple of custom colum

4条回答
  •  爱一瞬间的悲伤
    2020-12-20 16:22

    You cannot use ChannelValue column name in the where clause at the same select level.
    You will have to put this whole select in a subquery.

    select ....
    from 
    ( 
    your select query
    ) as innerSelect
    where ChannelValue > Limit * p.Percentage / 100
    

提交回复
热议问题