A question on joins which I'm again lost on :P

I have a query that returns x amount of rows (query 1 below).  The problem
I have is that CalcMethod defines several Attribute/Method pairs for an
Object, some of which may, and may not appear in the ScreenAttr table.

As it stands, the query only returns the records that appear in both
ScreenAttr -and- CalcMethod, however what I -really- want is all
Attribute/Methods from CalcMethod, and those that don't appear in
ScreenAttr to have null fields for X and Y, and those that do, to have
their values.

I think I need to use a union, or some form of join, but I'm not sure.
(This is probably really badly explain so I hope someone understands this).

Mark


Query 1:

SELECT DISTINCT
  D.Object, D.CalcTable, D1.X, D1.Y, d3.Attribute, d3.Method
FROM
  Objects D, ScreenAttr D1, CalcMethod d3
WHERE
  (d.Object = d3.Object) AND
  (d.Object = :Object) AND
  (d.Object = d1.Object) AND
  (d1.Attribute = d3.Attribute)
ORDER BY
  D.Object, d3.Attribute, d3.Method


-- 
Mark Derricutt

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to