A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Can I do this in a query?



 
 
Thread Tools Display Modes
  #1  
Old February 19th, 2010, 09:17 PM posted to microsoft.public.access.queries
Karin
external usenet poster
 
Posts: 272
Default Can I do this in a query?

tblNames: id (auto), name
tblSvcCode: id, name (there are only 2, 0=nonbill; 1=bill)
tblWIP: id(auto), EmpID (linkto tblNames), SVCcode(link to tblsvccode),WIP
WIP looks like:
id Emp ID SVC Code WIP
1 1 1 55
1 1 1 20
2 1 0 60
3 2 1 75
4 2 0 89
5 3 1 40
6 3 0 12

Can I get a single query to show me:
tblNames.Name Billable WIP NonBillable WIP
alpha (1) 75 60
etc
(all names will have multiple entires for billable and nonbillable, just
trying to keep this simple)
Thanks!
  #2  
Old February 19th, 2010, 10:15 PM posted to microsoft.public.access.queries
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default Can I do this in a query?

First create a query called something like qryWipBill that looks like this:

SELECT tblNames.[Name],
tblSvcCode.[name],
TblWIP.WIP
FROM tblSvcCode
INNER JOIN (TblWIP INNER JOIN tblNames
ON TblWIP.[Emp ID] = tblNames.ID)
ON tblSvcCode.id = TblWIP.[SVC Code];

Then create a crosstab like so:

TRANSFORM Sum(qryWipBill.[WIP]) AS SumOfWIP
SELECT qryWipBill.[Name], Sum(qryWipBill.[WIP]) AS [Total Of WIP]
FROM qryWipBill
GROUP BY qryWipBill.[Name]
PIVOT qryWipBill.[name];


--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"Karin" wrote:

tblNames: id (auto), name
tblSvcCode: id, name (there are only 2, 0=nonbill; 1=bill)
tblWIP: id(auto), EmpID (linkto tblNames), SVCcode(link to tblsvccode),WIP
WIP looks like:
id Emp ID SVC Code WIP
1 1 1 55
1 1 1 20
2 1 0 60
3 2 1 75
4 2 0 89
5 3 1 40
6 3 0 12

Can I get a single query to show me:
tblNames.Name Billable WIP NonBillable WIP
alpha (1) 75 60
etc
(all names will have multiple entires for billable and nonbillable, just
trying to keep this simple)
Thanks!

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:45 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.