database - Select an output column to be used for LIKE -


i want use like column output of convert, code below. not working since column i've selected doesn't belong view i've been using. there way me way? or shall create new view instead?

select  [description], convert(varchar, cast([item value]*[qty] money), 1) [total amount], vwitemlist [total amount] '%' + @targetitem + '%' 

you have use sub query or repeat since cannot refer alias in where-clause

select  [description], convert(varchar, cast([item value]*[qty] money), 1) [total amount], vwitemlist convert(varchar, cast([item value]*[qty] money), 1) '%' + @targetitem + '%' 

another option, cte similar sub query:

with cte (     select [description],             convert(varchar, cast([item value] * [qty] money), 1) [total amount],        vwitemlist  ) select [description],        [total amount]   cte   [total amount] '%' + @targetitem + '%'  

Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -