Select is giving too less and strange data?
Carsten Friehe
rblists at online.de
Wed Nov 8 17:59:29 CST 2006
Hi!
Regarding to my problem with the select yesterday I found that there are
some strange things happening.
A:
Name (Varchar)
Number(Long)
record1: "record1", 1
record2: "record2", 2
B:
PtrA (ObjectPtr)
PtrC (ObjectPtr)
Number2 (long)
record1: 2, 1, 1
record2: 2, 1, 2
record3: 2, 1, 1
select A.recid,
A.name,
B.PtrA,
B.Number2
from A,
B
where A.recid = B.PtrA
This results in 0 records. I expected the following:
2, "record2", 1, 1
2, "record2", 1, 2
2, "record2", 1, 1
Now I am changing the select to an outer join:
select A.recid,
A.name,
B.PtrA,
B.Number2
from A,
B
where A.recid *= B.PtrA
This results in 2 records:
1, "record1", null, null
2, "record2", null, null
Now the other side:
select A.recid,
A.name,
B.PtrA,
B.Number2
from A,
B
where A.recid =* B.PtrA
This results in 3 records:
null, null, 2, 1
null, null, 2, 2
null, null, 2, 1
Now an outer join with group by and count():
select A.recid,
A.name,
B.PtrA,
count(B.Number2)
from A,
B
where A.recid *= B.PtrA
group by A.recid, A.name, B.PtrA
This results in 2 records:
1, "record1", null, 1
2, "record2", null, 1
Now the outer join the other way round:
select A.recid,
A.name,
B.PtrA,
count(B.Number2)
from A,
B
where A.recid =* B.PtrA
group by A.recid, A.name, B.PtrA
This results in 1 records:
null, null, 2, 3
These results are all strange and I don't know what to do to get the
correct results. Can someone explain me why this happens?
Best Regards,
Carsten
PS: I am using V4RB 2.5b12
More information about the Valentina
mailing list