GROUP BY???

F

Faraz A. Qureshi

Upon creating a simple query requiring a table with following fileds:
Field1, Field2, Field3

To be grouped as follows:

SELECT Table1.Field1, Table1.Field2, Sum(Table1.Field3) AS SumOfField3
FROM Table1
GROUP BY Table1.Field1, Table1.Field2;

I have found that still duplicates are occurring and Field1 & Field2,
although grouped, appear more than once.

What might be the reason? and the way out???
 
A

Allen Browne

What data types are field1 and Field2?

Text fields may have differences that are not immediately obvious (e.g. a
leading space, a second line in the field, or a zero-length-string as
distinct from Null.)

Floating point fields (Double, Single, or even Date) may have fractional
values that *display* the same, but are slightly different.

If there is anything in the Format property, that could also mask different
values so they appear to be the same.

If the query's source is actually another multi-table query with an outer
join, grouping on yes/no fields can fail as discussed here:
http://allenbrowne.com/bug-14.html

Also, if Field1 or Field2 contains a Null, results may be inconsistent
across different data engines.

If none of those apply, tell us your version of Access, and whether these
are local tables (in the database), or attached tables (from another
database -- if so, Access or what kind?)
 

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.

Ask a Question

Top