Hi Pros, I'd like to ask help on this small query of mine. Im doing a query and a sub query on my sub query i want to have it parameterized. Is there a way to do it? Please see my query script.
select sum(issue) as [Issue], sum(nonissue) as [NonIssue]
from
(
AS
select
case when isissue = 1 then 1 else 0 end as 'issue',
case when isissue = 0 then 1 else 0 end as 'nonissue',
LastTicketStatusID
from
vw_Tickets
where
LastTicketStatusID = @LastTicketStatusID
)
as Tickets
I always got an error Must declare the table variable "@LastTicketStatusID". where should i declare the parameter?
Thanks, Nhoyti