I am working with SQL Server 2005.
I am having 3 table
Product
PId | PName
Service
SId | SName
Bill
BId | TypeId | IsService
TypeId is PId or SId. based on IsService Field.
If IsService is 1 then TypeId is SId and If IsService is 0 then TypeId is PId
I want to fetch PName and SName with Bill so how can I?
I am thinking of to Write stored Procedure for this..
and Adding Dynamic Column to Stored Procudure that column contain Either SName or PName as per IsService.
But don’t know how to write this also?
Maybe something like this: