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

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -