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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:59:11+00:00 2026-05-20T18:59:11+00:00

I have two tables Table 1 Date ID State 3/22 1 state 1 3/21

  • 0

I have two tables

Table 1
Date     ID      State
3/22     1       state 1
3/21     2       state 2
3/20     3       state 1


Table 2
Date     ID      New_State
3/21     1       state 3
3/20     2       state 3

Table 1 becomes

Table 1
Date      ID      State
3/22      1       state 1
3/21      2       state 3
3/20      3       state 1

This is what I want to do:

If Table1.ID = Table2.ID and Table1.Date <= Max(Table2.Date) and Table1.Date >= Min(Table2.Date) Then
I want to change Table1.State to Table2.New_State where the row used is has the Max Date where Table2.Date >= Table1.Date

How would I do this? I have been trying forever with UPDATE queries.

  • 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-05-20T18:59:12+00:00Added an answer on May 20, 2026 at 6:59 pm

    First thing, “Date” should NEVER be used a a field name, it’s a reserved word. You’re looking for trouble. I don’t even want to write that down, so I will use myDate instead.
    Second thing, why use an update query ? 90% of the times they are not necessary. Think twice.

    That said, you have to first make a query on table 2 to find out the Min and Max. Something like:

    SELECT ID, Min([myDate]) as Start, Max([myDate]) as Finish FROM t2 GROUP BY id
    

    Save that query to qLimits, and make an update query where you join Table1 with qLimits on ID, and set a filter for Table1![myDate] = Between qLimits!Start and qLimits!Finish

    That should do it.

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

Sidebar

Related Questions

I have two tables which looks something like this Table Queue int ID; string
I have two tables with the following schema: CREATE TABLE sales_data ( sales_time date
I have two tables like this Table Product ProductId - int <PK> ProductExpiry -
I have two tables in my database that look like this CREATE TABLE IF
I have two tables table1 and table2. Table2 is having less number of rows
I have two tables: Client(id,name,...) Purchase(id,item,date,client_id,...) They have their respective Model, with their validations.
I have two tables with the following columns: table1: id, agent_name, ticket_id, category, date_logged
i work with php/Mysql i have table with two cols (date , cash) with
I have two tables: Table 1: ID, PersonCode, Name, Table 2: ID, Table1ID, Location,
I have two tables: a source table and a target table. The target table

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.