Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Criteria Question

Status
Not open for further replies.

fredk

Technical User
Jul 26, 2001
708
0
0
US
I have a table which is linked via an odbc connection. The fields are as follows:

MainGroup = a 6 digit text field which represents a company that is our client
Sub-Group = a 3 digit text field (there may be several sub-groups for a mainGroup)
SubsID = a 9 digit text field that represents an employee which is part of a company (under subgroup/maingroup)
PrdID = a 5 digit field that represents a product that a company might have -

Example of data
SubGroup MainGroup SubsID PrdID
000 123456 123456789 G1234
000 123456 123456789 P1234

Lets just say that there is only one employee under group 000-123456.....

I tried to pull this data via a query and ended up with two records but both had P1234 as the PrdID even though there is one G1234 and one P1234.

When I added the "totals" to the query, I received the expected result.

What am I doing wrong - I thought that my original query without the totals would give me the G1234 and P1234 instead of two P1234's ?

Thanks for any help.

Fred
 
Hi fredk,

If the group by works then it could be the joins between your tables.

Could be the sequence you are linking tables or check that they are only matching records, not all from one and only matching from the other.
 
Thanks dalenz - Since I was having a problem, I ran a query off only the one table and still get the same thing unless I use a totals query.

I really thing it has something to do with the table structure - Thanks much for the help!

Fred
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top