W
webicky
Using Access 2003, It is easy for me to a distinct Left join: Table 1
ID has 157 unique ID records. table 2 has 249 records some duplicate
records in order id.
SELECT DISTINCT [table1].id, [table2].CountOforderid
FROM [table1] LEFT JOIN table2 ON [table1].id = table2.id;
basically counts the order id uniquely among the 157 table 1 id's,
However, I would like to add another field one that has duplicates in
table2, but I only want the data for the unique 157
How do I get unique records in table 1 with some of the table 2 data?
When I add the new field in access i get:
SELECT DISTINCT [table1].id, [table2].CountOforderid, table2.product
FROM [table1] LEFT JOIN table2 ON [table1].id = table2.id;
I understand why its giving me the dups since its looking at
table2.product which has duplicate records.
What I don't understand is how to get all the unqiue data from table
1 (only the 157 unique id's THEN get the data from table2.
1) what's the correct SQL.
2) Is there a way to use the Access functions (rather than the custom
SQL to get this work)?
ID has 157 unique ID records. table 2 has 249 records some duplicate
records in order id.
SELECT DISTINCT [table1].id, [table2].CountOforderid
FROM [table1] LEFT JOIN table2 ON [table1].id = table2.id;
basically counts the order id uniquely among the 157 table 1 id's,
However, I would like to add another field one that has duplicates in
table2, but I only want the data for the unique 157
How do I get unique records in table 1 with some of the table 2 data?
When I add the new field in access i get:
SELECT DISTINCT [table1].id, [table2].CountOforderid, table2.product
FROM [table1] LEFT JOIN table2 ON [table1].id = table2.id;
I understand why its giving me the dups since its looking at
table2.product which has duplicate records.
What I don't understand is how to get all the unqiue data from table
1 (only the 157 unique id's THEN get the data from table2.
1) what's the correct SQL.
2) Is there a way to use the Access functions (rather than the custom
SQL to get this work)?