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!

Grouping Query results 1

Status
Not open for further replies.

kastaman

IS-IT--Management
Sep 24, 2001
181
0
0
CA
Hi there,

In my access query, I'd like to group the file names according to the first 3 letters of the file:

File name = Query Grouping result
Alpine = Alp*
Alpo = Alp*
Beta = Bet*
Bettin = Bet*



Thanks in advance,

Kastaman
 
Leslie,

My query looks like:

SELECT DISTINCTROW tbl_Client_Data.Client, [199911].Jobname, Sum([199911].Impressions) AS [Print Impressions]
FROM 199911, tbl_Client_Data
GROUP BY tbl_Client_Data.Client, [199911].Jobname
HAVING (((tbl_Client_Data.Client) Like "*mellon*") AND (([199911].Jobname) Like "ALP*" Or ([199911].Jobname) Like "BET*"));

This work fine but the result shows all jobnames. I'd like the results grouped and summarized according to ALP & BET.


Thanks in advance,

Kastaman
 
modify it slightly to:

Code:
SELECT DISTINCTROW tbl_Client_Data.Client, [199911].Jobname, Sum([199911].Impressions) AS [Print Impressions]
FROM 199911, tbl_Client_Data
WHERE (((tbl_Client_Data.Client) Like "*mellon*") AND (([199911].Jobname) Like "ALP*" Or ([199911].Jobname) Like "BET*"))
GROUP BY tbl_Client_Data.Client, [199911].Jobname;

Leslie
 
Hi there,

Here is an example of how the query works and what I actually wanted to accomlpish:

Current Query:
Client Jobname Print Impressions
Mellon EITFKGCN 24,303.00
Mellon EITFKGEN 15,183.00
Mellon EITFKNBN 12,906.00

Expected Result:
Client Jobname Print Impressions
Mellon EIT 52,392.00

I'd like the query to group and summarize and changing the jobname value to EIT for example.




Thanks in advance,

Kastaman
 
Kastaman,

Try changing to something like this, using the Left function to display and group on only the first three characters:
Code:
SELECT DISTINCTROW tbl_Client_Data.Client, Left([199911].Jobname,3), Sum([199911].Impressions) AS [Print Impressions]
FROM 199911, tbl_Client_Data
WHERE (((tbl_Client_Data.Client) Like "*mellon*") AND (([199911].Jobname) Like "ALP*" Or ([199911].Jobname) Like "BET*"))
GROUP BY tbl_Client_Data.Client, Left([199911].Jobname,3);


Hoc nomen meum verum non est.
 
Cosmo!!

That is exactly what I needed. Thanks so much.

Thanks in advance,

Kastaman
 
Kastaman,

You could have gotten this answer with the first response if you had included your sample data and expected results in your original posting.

Leslie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top