SQL-Server - Unable to use AND logical operator between two columns

Viewed 38

This is the following error I am getting:

Error: An expression of non-boolean type specified in a context where a condition is expected, near 'and'.

select p.BusinessEntityID, p.FirstName, p.LastName, bea.BusinessEntityID, bea.AddressID
from Person.Person as p
left join
Person.BusinessEntityAddress as bea on 
p.BusinessEntityID = bea.BusinessEntityID
where bea.BusinessEntityID and bea.AddressID is NOT NULL
1 Answers

where expression is not clear. you must write like

where bea.BusinessEntityID Is Not NuLL and bea.AddressID is NOT NULL

or remove it like

 where bea.AddressID is NOT NULL

bea.BusinessEntityID checked on join, you don't need it. remove is better

Related