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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:37:12+00:00 2026-06-08T17:37:12+00:00

I have a complex query in Access 2010 where: query1 is a query WHERE

  • 0

I have a complex query in Access 2010 where:
query1 is a query WHERE field1 <> 8
and
query2 is the same query WHERE field1=8.

Then I am doing:

SELECT * FROM query1 
INNER JOIN query2 ON query1.field2=query2.field2 
WHERE query1.field3=query2.field3

This returns 0 results.

However when I change it to:

SELECT * from query1 
INNER JOIN query2 ON query1.field2=query2.field2 
WHERE query1.field3=5 AND query2.field3=5

I do get results. Does this make sense to anybody? Could it have to do with on of the fields being considered a text field? except it works without quotes so I don’t know why that would be.

Please let me know if you have seen this before.

This is the full query:

SELECT *
FROM   (SELECT [transactions by category].[categoryid],
           Month([account transactions].[transaction date]) AS TransMonth,
           Year([account transactions].[transaction date])  AS TransYear,
           SUM([transactions by category].[amount])         AS Amount
    FROM   (categories
            INNER JOIN [transactions by category]
                    ON categories.id =
           [transactions by category].categoryid)
           INNER JOIN [account transactions]
                   ON [transactions by category].transactionid =
                      [account transactions].id
    WHERE  [account transactions].[transaction type] <> 8
    GROUP  BY [transactions by category].[categoryid],
              Year([account transactions].[transaction date]),
              Month([account transactions].[transaction date])) AS
   TransactionCredits
   INNER JOIN (SELECT [transactions by category].[categoryid],
                      Month([account transactions].[transaction date]) AS
                                         TransMonth,
                      Year([account transactions].[transaction date])  AS
                      TransYear
                                         ,
                      SUM(
          [transactions by category].[amount])
               FROM   (categories
                       INNER JOIN [transactions by category]
                               ON categories.id =
   [transactions by category].categoryid)
                      INNER JOIN [account transactions]
                              ON [transactions by category].transactionid =
                                 [account transactions].id
               WHERE  [account transactions].[transaction type] = 8
               GROUP  BY [transactions by category].[categoryid],
                         Year([account transactions].[transaction date]),
                         Month([account transactions].[transaction date]))
              AS
                                 TransactionDebits
           ON TransactionCredits.[categoryid] =
              TransactionDebits.[categoryid]
WHERE  TransactionCredits.transyear = TransactionDebits.transyear
   AND TransactionCredits.transmonth = 8
   AND TransactionDebits.transmonth = 8; 
  • 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-08T17:37:13+00:00Added an answer on June 8, 2026 at 5:37 pm

    So, I’ve been banging my head against the wall for months on this. I finally found the solution, but I don’t fully understand why this works.

    Instead of just saying

     SELECT * 
     FROM query1 
     INNER JOIN query2 ON query1.field2=query2.field2 
     WHERE query1.field3=query2.field3"
    

    I changed the WHERE clause to say

    VAL(query1.field3)=VAL(query2.field3)
    

    Both of these fields were originally integer ID columns but apparently one of them became a text field of some sort somewhere in one of the queries.

    I would still be interested in hearing an explanation of how this works.

    Thanks

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

Sidebar

Related Questions

I have a quite complex multi-join TSQL SELECT query that runs for about 8
I have a complex Query (Without any locking hints) that takes data from many
I have a select from (nothing to complex) Select * from VIEW This view
I have a complex query that gets executed like this: if ($stmt = $dbi->prepare($pt_query))
I have a complex sql query that I have in a stored procedure and
I have a fairly complex data model and consequently a fairly complex query (using
I have following somewhat complex sql query which has horrible performance, 'certainly' due to
System: Windows7, Access 2003, .mdb file, C# language, VS 2010 I'm doing queries with
I think the title speaks for itself. I have a complex query with a
I have a rather complex database-query which gives me 30 million records - roughly

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.