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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grouping query

Status
Not open for further replies.

HomeGrowth

Technical User
Joined
Aug 19, 2004
Messages
76
Location
US
These are the records:

Name TaskName Complete
Tom 1 Yes
Tom 1 Yes
Tom 1 Yes
Tom 2 Yes
Tom 2 No
Tom 2 Yes

I need to create a query to indicate whether the person has completed the task or not, based on the Yes or No answer (the datatype is text for the Complete field). If the tasks are all 'Yes', the task is complete. If there is one 'No', then the task is 'No'.

Name TaskName Complete
Tom 1 Yes
Tom 2 No

Thanks for the help.
 
Try something like:
Code:
SELECT [Name], TaskName, Min(Complete) as IsComplete
FROM [These are the records]
GROUP BY [Name], [TaskName];

Duane
Hook'D on Access
MS Access MVP
 
Thank you dhookom

Excellent query, it works great. Thanks again
 
One more question, based on the result, I got

Name TaskName Complete
Tom 1 Yes
Tom 2 No

Now, how can I do a tally like this in query?

Name #ofTask Yes No
Tom 2 1 1

Thank you in advance.
 
Create a crosstab query from your previous query:
Code:
TRANSFORM Count([Name]) AS CountOfName
SELECT [Name], Count(TaskName) AS NumOfTasks
FROM qgrpTaskYesNo
GROUP BY [Name]
PIVOT IsComplete;

Duane
Hook'D on Access
MS Access MVP
 
dkookom Thanks again. I've learned so much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top