W
|
wildwally 11/7/2011 |
How are you getting duplicates if its a unique number? |
C
|
copper21 author 11/7/2011 |
Wildwally, |
W
|
wildwally 11/7/2011 |
From that link provided there is a section explaining why the Where does not work with Group By. |
C
|
copper21 author 11/8/2011 |
WildWally, |
W
|
wildwally 11/8/2011 |
WildWally, Thank you for your help! I did get the results I was looking for. I am better understanding this now...for some reason GROUP BY is difficult for me. Now here is one more request. I have some other columns that I need displayed with regards to the results. In addition to grouping the matchcode, I have to display the rest of the columns in the table. Here is what the query looks like without grouping: SELECT table_id, field1, field2, field3, matchcode FROM tablename Here is what works with what you have told me: SELECT matchcode, COUNT () FROM tablename GROUP BY matchcode HAVING COUNT () >1 I need to include field1, field2, field3 in the query keeping matchcode as the GROUP BY column. This has really been what I am having problems with. I would like the results to look something like: matchcode | table_id | field1 | field2 | field3 Thanks again in advance for your help on this! Brian
|
C
|
copper21 author 11/8/2011 |
WildWally, |
W
|
wildwally 11/8/2011 |
WildWally, When I do that query, I get "IDispatch error #3092 Column 'table_id' is invalid in the select list becuase it is not contained in either an aggregate function for the GROUP BY cluase" SELECT matchcode, table_id, field1, field2, field3, COUNT() FROM tablename GROUP BY matchcode HAVING COUNT() >1 If I GROUP BY all of the columns, I dont get an error, but matchcode is no longer "grouped" and all of the matchcodes are counted as 1 and I get no results from the query because of the HAVING >1 Brian
|
C
|
copper21 author 11/8/2011 |
WildWally, |
C
|
copper21 author 11/8/2011 |
WildWally, |
W
|
wildwally 11/8/2011 |
WildWally, That is the problem that I am coming across as well. Unfortunately, I need to group together the matchcodes that are duplicates, but some of the fields on that record do not match. I need to be able to display them. The weird thing is that when I run the report I created to do this, it works exactly like I want to, but the killer is trying to figure out how to display only the records that have the grouped together matchcodes...any thoughts Xlinesoft? Thanks, you guys are all great for newbs like me! Brian
|
C
|
copper21 author 11/8/2011 |
WildWally, |