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

  • SEARCH
  • Home
  • 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

Related Questions

I have a Maketable query in an Access db that could use an Autonumber
I have the following Access query: SELECT [city] FROM [patient] WHERE REPLACE([patient].[city],' ',' ')
I have a query stored in MS Access which is doing a standard select
I have a somewhat complex query that I want to use as a source
I have a query in Access 2007. It's worked fine for months, but I'm
I have a query being created using OLEDB from access and need to get
I have an Access report built on a query, and the [status] field for
I have the following Access 2002 query I'm running through OLE DB in .NET:
Here is my access query that I have. Every value that I return is
I have a problem running an insert query via C# OleDbCommand to an Access

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.