SQLTeam.com | Weblogs | Forums

Problem with where statment when trying making it automatic

Good day today i manage to come across a problem when i am using where statment in my quri and refer to table
like

when A1.Month <> B2.Date
and then cheking resolt they still contain resolt that equal A1.Month = B2.Date
but when i do it manualy
where A1.Month <> '2020-11-01'
and A1.Month <> '2020-12-01'
it do all corecly what can be a problem ?

below is workin exsample but insterd of
where A1.Month <> '2020-11-01'
and A1.Month <> '2020-12-01'
in firs i need to have
where A1.Month <> B2.Date
but id doesnt work (

select
A1.Month as Date,
A1.Scenario,
A1.Account,
A1.Organisation,
A1.Tracking_Category_2,
A1.Tracking_Category_1,
case
when A1.Month = B2.Date
and a1.Tracking_Category_1 = AllocateFromTc
then AllocateToTc
else a1.Tracking_Category_1
end as Tracking_Category_d,
A1.TEXT_VAL,
case
when A1.Tracking_Category_1 = AllocateFromTc
and A1.Month = B2.Date
then A1.Amount*[Percent]/100
else A1.Amount
end as Amountd
,A1.Amount

from OLAP A1 , OLAP.Test B2
where A1.Month <> '2020-11-01'
and A1.Month <> '2020-12-01'

union

select
A1.Month as Date,
A1.Scenario,
A1.Account,
A1.Organisation,
A1.Tracking_Category_2,
A1.Tracking_Category_1,
case
when A1.Month = B2.Date
and a1.Tracking_Category_1 = AllocateFromTc
then AllocateToTc
else a1.Tracking_Category_1
end as Tracking_Category_d,
A1.TEXT_VAL,
case
when A1.Tracking_Category_1 = AllocateFromTc
and A1.Month = B2.Date
then A1.Amount*[Percent]/100
else A1.Amount
end as Amountd
,A1.Amount

from OLAP. A1 , OLAP.Test B2
where A1.Month = B2.Date

What data type are Month and Date?

thanks