I have a table:
create table test_table
(customer_num NUMBER,
dep_group VARCHAR2(50),
dep_type VARCHAR2(50),
balance NUMBER)
the table has two records:
" test_table "
--------------------------------------------------
customer_num dep_group dep_type balance
1 x x1 10
1 x x2 10
The query below must return two records of the table but it does not, and it's weird!!
select *
from test_table
where ((dep_group = 'x') AND (dep_type = 'x1') AND ((balance) > 1)
AND
((dep_group = 'x') AND (dep_type = 'x2') AND ((balance) > 1)))
when I run each part of the query separately , it gives me the desired record
Q1:
select *
from test_tablet t
where (dep_group = 'x') AND (dep_type = 'x1') AND ((balance) > 1)
Q2:
select *
from test_tablet t
where (dep_group = 'x') AND (dep_type = 'x2') AND ((balance) > 1)
I mean customer = 1
matches both conditions and the original query must give me the two records of the table. Is there something wrong with my query or my understanding of the logical operators?
Thanks in advance.
dep_type
cannot possibly be equal to 'x1' AND 'x2' at the same time, can it – mustaccio May 26 '20 at 12:01