I am working on a query that requires the use of flags from 2 different tables. I did a left join to get the columns but the alias cannot be used in the where clause.
Why does the ZH021ProcessedFlag work but the ImportReady flags do not read? I tried to use single quotes around the variable but there are no records outputted.
Any help around this would be appreciated!
SELECT rb.TransID, rb.TriggerInstanceID, rb.InstanceID as InstanceID, rb.SubmissionID,EventNumber,nb.SubmissionType as SubmissionType,EventSequenceNumber,FTE,Allocation,EventBudgetFund,EventBudgetUnit,EventBudgetDepartment,EventBudgetObjectID,EventBudgetActivity,EventBudgetFunction,EventBudgetPercent,nb.ZH021ProcessedFlag as ZH021ProcessedFlag,ZH022ProcessedFlag,nb.ImportReady as ZH21ImportReady,rb.ImportReady as ZH22ImportReady FROM [dbo].[EventNumberRequestBudget] rb LEFT JOIN dbo.EventNumberRequest nb on nb.InstanceID = rb.InstanceIDWHERE 'ZH22ImportReady' = '0' AND 'ZH21ImportReady' = '0' AND ZH021ProcessedFlag = '0' AND ZH022ProcessedFlag = '0';