Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 116731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:13:28+00:00 2026-05-11T03:13:28+00:00

In MS Access, I have a query where I want to use a column

  • 0

In MS Access, I have a query where I want to use a column in the outer query as a condition in the inner query:

SELECT P.FirstName, P.LastName, Count(A.attendance_date) AS CountOfattendance_date,        First(A.attendance_date) AS FirstOfattendance_date,        (SELECT COUNT (*)            FROM(SELECT DISTINCT attendance_date                  FROM tblEventAttendance AS B                  WHERE B.event_id=8                    AND B.attendance_date >= FirstOfattendance_date)        ) AS total FROM tblPeople AS P INNER JOIN tblEventAttendance AS A ON P.ID = A.people_id WHERE A.event_id=8 GROUP BY P.FirstName, P.LastName ; 

The key point is FirstOfattendance_date – I want the comparison deep in the subselect to use the value in each iteration of the master select. Obviously this doesn’t work, it asks me for the value of FirstOfattendance_date when I try to run it.

I’d like to do this without resorting to VB code… any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:13:28+00:00Added an answer on May 11, 2026 at 3:13 am

    How about:

    SELECT       p.FirstName,      p.LastName,      Count(a.attendance_date) AS CountOfattendance_date,      First(a.attendance_date) AS FirstOfattendance_date,      c.total FROM (      tblPeople AS p  INNER JOIN tblEventAttendance AS a ON       a.people_id = p.ID)  INNER JOIN (SELECT people_id, Count (attendance_date) As total             FROM (                 SELECT DISTINCT people_id,attendance_date                 FROM tblEventAttendance)              Group By people_id) AS c ON       p.ID = c.people_id GROUP BY       p.ID, c.total; 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 65k
  • Answers 65k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Sure thing! Grouping and references are your friends: (.)\1+ Will… May 11, 2026 at 11:13 am
  • added an answer You could use commons lang's ArrayUtils. array = ArrayUtils.removeElement(array, element)… May 11, 2026 at 11:13 am
  • added an answer I've had similar problems in the past. Then I came… May 11, 2026 at 11:13 am

Related Questions

In MS Access, I have a query where I want to use a column
I have a report in MS Access where the underlying data in the tables
I have a field on a table in MS Access, tblMyTable.SomeID, and I want
I have created a report in MS Access report and write some VBA code
I have got a table in MS Access 2007 with 4 fields. Labour Cost
I have built a MS Access 2007 application that can create reports files in
I have the table (Product_Id, category priority, atribute1, atribute2...) in MS Access, and I
This request is based in MS Access VBA. I would like to know what
How can I programmatically make a query in MS Access default to landscape when
I want to programmatically create a new column in an MS Access table. I've

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.