Link to home
Start Free TrialLog in
Avatar of Michael Franz
Michael Franz

asked on

SQL Where Clause Help

I have the following code and I do not know how to modify it for the following..... I need to add a where clause for the following.

Where Referral_Source is NOT NULL OR BLANK/EMPTY.




SELECT NewBusinessHeader.Exec_Name, NewBusinessHeader.Client_Last_Name, NewBusinessLineItem.EffectiveDate, NewBusinessLineItem.Carrier, NewBusinessLineItem.LineOfBusiness, NewBusinessLineItem.SoldPremium, NewBusinessLineItem.Sold, NewBusinessHeader.Referral_Source,NewBusinessHeader.Branch,NewBusinessHeader.Dept,NewBusinessHeader.Customer_Number as Agency_Rev,NewBusinessHeader.Process_Complete_Date,NewBusinessHeader.Group_Submission_Number

FROM NewBusinessHeader INNER JOIN NewBusinessLineItem ON NewBusinessHeader.NBHeaderID = NewBusinessLineItem.NBHeaderID

WHERE ((NewBusinessLineItem.Sold='Yes')) AND (([NewBusinessHeader].[Process_Complete_Date])>=<<Enter the From Date[Date]>> AND [NewBusinessHeader].[Process_Complete_Date]<= <<Enter the To Date[Date]>>) AND (((NewBusinessHeader.Dept) In (<<Enter Personal Lines, Commercial Lines, Benefit lines (seperated by a comma for mulitple) [Text]+>>)))

UNION ALL

SELECT Submissions.Exec_Name, Submissions.Client_Last_Name,Submissions.EffectiveDate,Submissions.Carrier, Submissions.LineOfBusiness,Submissions.SoldPremium,Submissions.Sold,Submissions.Referral_Source,Submissions.Branch,Submissions.Dept,Submissions.Agency_Rev,Submissions.Process_Complete_Date,Submissions.Group_Submission_Number

FROM Submissions

WHERE ((Submissions.Sold='Yes')) AND Process_Complete_Date >= <<Enter the From Date[Date]>> AND Process_Complete_Date<= <<Enter the To Date[Date]>> AND (((Submissions.Dept) In (<<Enter Personal Lines, Commercial Lines, Benefit lines (seperated by a comma for mulitple) [Text]+>>)))

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Bhavesh Shah
Bhavesh Shah
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Michael Franz
Michael Franz

ASKER

thnka for the assistance. I got it now.