Hi everybody
I Have two kind of tables that each one has Draft and Original Report Types.
I have made a query to fetch data but I don't know how to get the right tables data from my parameters.
This is my code:
declare @ReportType tinyint = 1;
declare @DraftOrginal tinyint = 1;
select
*
from
Joint as j
left join(
select
Fitup_DraftId,
Fitup_OrgId,
FitupID,
JointID
from
QC_Fitup as ) as f on f.JointID = j.JointID
left join (
select
Weld_DraftId,
Weld_OrgId,
FitupID
from
QC_Weld as w ) as w on w.FitupID = f.FitupID
Now I want this kind of where clause :
where if( @ReportType =1 AND @DraftOrg=1) then f.Fitup_DraftId =1000
where if( @ReportType =1 AND @DraftOrg=2) then f.Fitup_OrgId =1001
where if( @ReportType =2 AND @DraftOrg=1) then w.Weld_DraftId =1002
where if( @ReportType =2 AND @DraftOrg=2) then w.Weld_OrgId =1004