By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,460 Members | 2,215 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,460 IT Pros & Developers. It's quick & easy.

Group By

P: n/a
First I have to say I do not know SQL or VB very well...so if I'm able
to get this to work without learning a new language then I'll be
ecstatic.

OK...I have a tbl of approximately 1000 lines of data and about 20-30
columns each. The actual query itself is irrelevant, but I'm meshing
this up against multiple other tbls that I'm linked too. What I need
is this 1000 lines of data to remain in tact (at least what's left of
them) when the query is complete. However when it is complete the
1000 lines of data turns into 15000 lines of data. If anything I
should only see a fraction of the original 1000 records (maybe
300-400). I can't do group by on something so large and with so much
information.

There is one field that is distinct in every line of my original tbl.
How can I do a group by on that one field only though. I've seen the
SELECT DISTINCT command used before and tried to build that into my
SQL statement but it doesn't work. Should I "Make new table" with the
15000 lines and then build a new query with SELECT DISTINCT command,
if so what is the correct format if this is all I want it to do.

Thanks,
Shawn Stump
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

"Shawn" <ss****@vartec.net> wrote in message
news:5b**************************@posting.google.c om...
First I have to say I do not know SQL or VB very well...so if I'm able
to get this to work without learning a new language then I'll be
ecstatic.

OK...I have a tbl of approximately 1000 lines of data and about 20-30
columns each. The actual query itself is irrelevant, but I'm meshing
this up against multiple other tbls that I'm linked too. What I need
is this 1000 lines of data to remain in tact (at least what's left of
them) when the query is complete. However when it is complete the
1000 lines of data turns into 15000 lines of data. If anything I
should only see a fraction of the original 1000 records (maybe
300-400). I can't do group by on something so large and with so much
information.

There is one field that is distinct in every line of my original tbl.
How can I do a group by on that one field only though. I've seen the
SELECT DISTINCT command used before and tried to build that into my
SQL statement but it doesn't work. Should I "Make new table" with the
15000 lines and then build a new query with SELECT DISTINCT command,
if so what is the correct format if this is all I want it to do.

Thanks,
Shawn Stump


Shawn, it's going to be difficult for anyone here to help unless you provide
more information. You might want to post the SQL that you are using. Are
you working in the Access query builder? From what you have provided, I
would say that SELECT DISTINCT is definitely not the solution to your
problem. It sounds as though you might be getting what is commonly termed a
Cartesian Product result. This is sometimes desirable but often not. It
can be a result of having tables in your query that are not properly joined.
Assuming that you are working in the Access query grid, begin by removing
all of the tables except for your primary data table. Build and run the
query, see if you get the desired set of records. If so, then add the next
table, create a join to the first table, then run the query again. Again,
see if you get the desired set of records. Then continue is this manner.

HTH,
Randy
Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.