Given a table defined like this:
MyTable
ItemID SubItemID SubItemValue
0 0 0
0 0 15
0 1 20
0 1 25
If I execute this self-join:
select t1.subItemID, t2.SubItemValue
from mytest t1, mytest t2
where t1.subitemid = 1 and
t2.itemid = t1.itemid and
t2.subitemvalue = 0
I get back:
SubItemID SubItemValue
1 0
1 0
which I understand.
But if I do this:
select t1.subItemID, t2.SubItemValue
from mytest t1, mytest t2
where t1.subitemid = 1 and
t2.itemid = t1.itemid and
t2.subitemvalue = 3
I get no rows back at all. I expected to get:
SubItemID SubItemValue
1 NULL
1 NULL
Can anyone explain to me what is going on there?
MyTable
ItemID SubItemID SubItemValue
0 0 0
0 0 15
0 1 20
0 1 25
If I execute this self-join:
select t1.subItemID, t2.SubItemValue
from mytest t1, mytest t2
where t1.subitemid = 1 and
t2.itemid = t1.itemid and
t2.subitemvalue = 0
I get back:
SubItemID SubItemValue
1 0
1 0
which I understand.
But if I do this:
select t1.subItemID, t2.SubItemValue
from mytest t1, mytest t2
where t1.subitemid = 1 and
t2.itemid = t1.itemid and
t2.subitemvalue = 3
I get no rows back at all. I expected to get:
SubItemID SubItemValue
1 NULL
1 NULL
Can anyone explain to me what is going on there?