View Single Post
  #5  
Old March 31st, 2010, 11:22 AM posted to microsoft.public.access.gettingstarted
TheScullster
external usenet poster
 
Posts: 53
Default Another Query Question


"Ken Sheridan" wrote

Remove the Q1.ac_id column from the SELECT clause:

SELECT Q1.link_id, Q2.ac_id AS secondary_ac_id
FROM TheUnionQuery AS Q1
LEFT JOIN TheUnionQuery AS Q2
ON Q1.link_id = Q2.link_id AND Q1.ac_id Q2.ac_id
WHERE Q1.ac_id = [Enter ac_id;];

Note that I've changed the join type to a left outer join. This will
ensure
that a row is returned, even if there is no secondary linked account. If
you
don't want this leave it as an inner join.

Ken Sheridan


Thanks again Ken

I had managed to build a query or series of queries that returned both sides
of the search successfully.
The bit I was missing was the where clause.

With your help I feel I have made real progress.

Phil