Board index » delphi » Please help!!! Left Outer Join problems

Please help!!! Left Outer Join problems

I have a SQL query that when executed under the BDE 2.52 works perfectly and
when executed under BDE 5.1.1 returns a results set that is not only
incorrect it contains garbage in the results set.  I used the same exact
tables when performing the queries.

Here is the query
-----------------
select t.meetid, t.category, category.type, sum(t.amount) as Total,
b.budget, category.category as MainCat from
category left outer join transact t on (category.category = t.category),
category left outer join budgets b on (category.category = b.category)
where category.type = "I"
and transact.account = -1
and category.include = "T"
and t.meetid = 81
and b.meetid = 81
group by t.meetid, t.category, category.type, b.budget, maincat
order by maincat

In trying to figure out what was causing the problems with BDE 5.1.1, I have
found that all RIGHT OUTER JOINS do not return correct result sets.  If you
had 2 tables like the following:

Table1
ID        Name
---        ------
1            Test1
2            Test2
3            Test3

Table2
ID        Amount
---        -------
1            23
1            10
3            100

If you performed the following query on these tables:

select * from Table1 left outer join Table2 on Table1.ID = Table2.ID

You SHOULD get the following result set:

ID        Name        ID_1        Amount
---        ------        -----        --------
1            Test1        1            23
1            Test1        1            10
2            Test2
3            Test3        3            100

But what I am seeing when I run this is the following:

ID        Name        ID_1        Amount
---        ------        -----        --------
1            Test1        1            23
1            Test1        1            10
3            Test3        3            100

Notice that ID 2 is NOT listed.  It's as if the "outer" is not even being
taken into consideration.  If I do this with BDE 2.52 it works perfectly.

Anyone have any clues, help, suggestions, etc...??

Thanks
--
Scott

 

Re:Please help!!! Left Outer Join problems


Scott,

Against which database you execute your tests ?
Did you try to run them in Database Explorer ?

Jacek

Other Threads