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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:06:58+00:00 2026-06-16T13:06:58+00:00

I have a query like this: SELECT a.title, a.spec, a.name, l.User AS CreatedBy, DateAdd

  • 0

I have a query like this:

SELECT a.title,
       a.spec,
       a.name,
       l.User AS CreatedBy,
       DateAdd ( "s", l.time, #03/01/1980# ) AS CreatedAt
FROM 
    (Reports AS 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.time = t.mintime)
      AND (l.id = t.id)
WHERE (((a.ACTIVE)='Y'));

The table Reports has 15000 records and AuditLog has 25800. But this query only returns 7800 results, and I figured there would be more (an audit is generated when a Report is created, so one would assume there’s a matching audit for every Report).

What are some new queries I could make to research what is missing, such as record counts etc? I did try copying this query and using OUTER JOIN, but it gave me “Syntax error in JOIN operation”. Most are active, so removing the WHERE clause is not the cause.

  • 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-16T13:07:00+00:00Added an answer on June 16, 2026 at 1:07 pm

    Here’s an example of using Left Join.
    This will show all records in Reports, regardless of whether there are matches in the AuditLog table.

    Select
      a.title, 
      a.spec, 
      a.name, 
      l.User AS CreatedBy, 
      IIf(IsNull(l.Time), Null, DateAdd ( "s", l.time, #03/01/1980# )) AS CreatedAt
    From (
      Reports As a 
        Left Join
      AuditLog AS l 
        On a.id = l.id
      ) Left 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.Active = 'Y';
    

    Here’s an extract from the database documenter feature of my test database:

    Table: AuditLog                                             
    
         Name      Type          Size
         ID        Long Integer  4
         Time      Long Integer  4
         User      Text          255
    
    Table: Reports
    
         Name      Type          Size
         ID        Long Integer  4
         Title     Text          255
         Spec      Text          255
         Name      Text          255
         Active    Text          255
    
    Query: Test
    
    SQL
    
         SELECT a.title, a.spec, a.name, l.User AS CreatedBy, DateAdd ( "s", l.time,
         #03/01/1980# ) AS CreatedAt
         FROM (Reports AS a LEFT JOIN AuditLog AS l ON a.id = l.id) LEFT 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.Active = 'Y'
    
    Columns
    
         Name      Type          Size
         title     Text          255
         spec      Text          255
         name      Text          255
         CreatedBy Text          255
         CreatedAt Date/Time     8
    

    I notice Access has added some more parentheses in. Also, the documenter missed the where clause for some reason. It’s in the query definition.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SQLite query like this: SELECT Books.title, People.name FROM Books, People WHERE
I have a query like this: select empno,name from emp where job = 'CLERK'
I have a query like this SELECT TOWN, NAME FROM CINEMA WHERE CITY_ID =
I have a query like this SELECT user_id FROM user WHERE user_id NOT IN
I have a query like this: SELECT title,id FROM table1 WHERE id IN ('2','7','4','10')
I have query like this: $sql = SELECT * FROM global_info WHERE title LIKE
I have a sql query like this String loadFav = SELECT _id, title, name,
I have a query like: SELECT coc.title, inc.name FROM cocktail coc, ingredients inc WHERE
I have a query something like this: SELECT title, desc, date FROM tablename ORDER
I have a query that looks like this SELECT J.JobID,T.Title FROM JobsTagMap J Left

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.