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 8941547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:19:47+00:00 2026-06-15T11:19:47+00:00

I have this SQL in Access, but it is giving me an error. I’ve

  • 0

I have this SQL in Access, but it is giving me an error. I’ve tried moving the parenthesis around but it hasn’t resolved the issue.

SELECT
    a.title, a.id, a.name, l.user, l.time 
FROM
    Reports a
INNER JOIN (
    AuditLog AS l ON a.id = l.id
INNER JOIN (
(
    SELECT min(time) Mintime, id
    from AuditLog
    GROUP BY id
) AS t )
  ON l.id = t.id
  AND l.time = t.mintime )
WHERE
    a.NAME LIKE 'something*'
    AND a.ACTIVE='Y'

How can I resolve the syntax errors I’m getting?

  • 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. Editorial Team
    Editorial Team
    2026-06-15T11:19:49+00:00Added an answer on June 15, 2026 at 11:19 am

    This piece of your query should definitely create a problem:

    SELECT min(time) Mintime, id
    

    If you intend to alias the field expression min(time) as Mintime, you must use the AS keyword. You don’t need AS for a table alias but you do for a field alias:

    SELECT min(time) AS Mintime, id
    

    It seems time is a field in your AuditLog table. In that case enclose its name in square brackets to distinguish it from the Time() function:

    SELECT min([time]) AS Mintime, id
    

    As for the parentheses, you should use Access’ query designer to set up your joins if possible. It will guarantee your query includes the parentheses the db engine demands and will position them correctly.

    If that’s not an option, give this untested version a try:

    SELECT
        a.title, a.id, a.name, l.user, l.time 
    FROM
        (Reports a
        INNER JOIN AuditLog AS l
        ON a.id = l.id)
        INNER JOIN
            (
                SELECT min([time]) AS Mintime, id
                from AuditLog
                GROUP BY id
            ) AS t
        ON
                l.id = t.id
            AND l.time = t.mintime
    WHERE
            a.NAME LIKE 'something*'
        AND a.ACTIVE='Y'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this query which works fine in SQL Server, but not in Access,
I've had a look around but cannot find the issue with this SQL Statement:
I can't solve this on MS Access SQL. I have a foo table with
i have this sql query select * from table where name like ? but
I have this rather simple SQL query, but it takes almost a minute to
Are ordinary sql queries different from MS Access 2007 queries? I have this simple
I have this sql statement to update a column in access db from vb
I have this SQL statement: SELECT * FROM history WHERE (fk_person = 2119) AND
I have this sql string: Dim sqlQuery As String = SELECT TOP 1 ID,
I have this SQL query from the logs select content = 5%id%201=1 from pages

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.