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
Post a Comment