Hi,
this stored procedure will if not put any parameter or giving single or both parameter. it is flexible to run by any condition.
Please arrange proper table join & select query based on your requirement because you did not provide the proper table structure.
create procedure search
@Device varchar(50)=NULL,
@@Category varchar(50)=NULL
as
select t1.Device, t1.Category, t1.Date,t1.Company
t1.PersonName,t1.Reason
FROM table1 T1
JOIN table2 T2 ON T1.ID=t2.Id
WHERE Device=ISNULL(@Device,Device) AND Category=ISNULL(@Category,Category)