My apologies for the jocund reply to the answer to your question. I
suspect the problem is that you were looking at the query grid, not
the SQL view; it's FAR from obvious in the grid! You need to either go
to SQL view and edit in the DISTINCT keyword, or right mouseclick the
background of the tables, view Properties, and set the Unique Values
property to True.
My problem was that I selected columns from SALES table and needed to select
the corresponding address from MAIL table.
MAIL has multiple rows with the same key. I was not able to concatenate
using DISTINCT ADDRESS from MAIL and kept getting Syntaz error.
I created two queries: One for the SALES and the other from the MAIL with a
subquery (based the SALES criteria).
I still will like to know the way to have colums from both tables in a
single query.
You need to create a DISTINCT query on the MAIL table, and use that query in
place of the MAIL table. Then join it to the SALES table as you would any
other table.
SELECT sales.customerid, sales.field1, sales.field2, mymail.address
FROM sales
INNER JOIN (SELECT DISTINCT address, customerid FROM mail) AS mymail
ON mymail.customerid = sales.customerid
This of course, is a very simplistic example. If you were to advise us of
the columns in each table, and the specific columns you want to return, we
may be able to provide you with a more accurate resolution.
Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
I guess that this is what I was asking... the syntax
Jorge
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.