No, GROUP BY isn't required when joining tables.
As Jay mentioned, it's the ON clause that controls which records are returned.
As an aside, you should be aware that unless you have indexes on ALLTRIM(companyid) in both tables, the query is not Rushmore optimizable. My guess is that the companyid field is the same width in both tables. If that's true, your ON statement should probably read nDebit1.companyid == companyid.companyid. This way, the query is optimizable with indexes on companyid in both tables. This won't change which records are returned. If you want to send me the two tabled that don't return the records you want with the query, I'll take a look.
>I have this code:
>
>SELECT nDebit1.*, companyid.bankname AS bank, companyid.companyid AS newid ;
> FROM FORCE nDebit1 LEFT JOIN companyid ;
> ON ALLTRIM(nDebit1.companyid) == ALLTRIM(companyid.companyid) ;
> ORDER BY nDebit1.bankname, nDebit1.settdate, nDebit1.mid, ;
> nDebit1.amount, nDebit1.orgtracnum, nDebit1.dbaname, nDebit1.reasoncode, ;
> nDebit1.orgtracnum, nDebit1.cleared ;
> INTO TABLE ndebit2
>
>works okay most of the time. Every now anthen it leaves out a few records. I read in the HAckers Guide that you should use GROUP BY when you have a calculation of some type in the Select statement. Does that apply when you are joining two tables?
Brien R. Givens
Brampwood Systems