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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:35:33+00:00 2026-06-10T17:35:33+00:00

I have 3 tables as shown below table 1 ________________________________________________ id | effective_date |

  • 0

I have 3 tables as shown below

table 1
________________________________________________
id | effective_date     | table_3_id | acc_name |
___|____________________|____________|__________|
112|2012-02-01 12:00:00 |     23     | Over Pay |
___|____________________|____________|__________|

table 2
__________________________________
id    | table_1_id     | amount  |
______|________________|_________|
 1    |    112         |  400.00 |
______|________________|_________|

table 3
________________________________________
id  | emp_num  | first_name  | last_name|
____|__________|_____________|__________|
 23 |   100004 |   John      |    Doe   |  
____|__________|_____________|__________|

I have a start date and an end date and also a predefined value for acc_name. What I want to do is, to retrieve the emp_num, first_name, last_name and amount from relevant tables that have a effective_date that falls between start date and end date and also the acc_name should be the predefined value.

For above tables if my start date = 2012-01-30 12:00:00 , end date = 2012-03-01 12:00:00 and acc_name = Over Pay; then below values should be returned.

emp_num = 100004  
first_name = John  
last_name = Doe  
amount = 400.00

How can I do this? I am not sure whether joining all 3 the tables is the best approach here. Can anyone help?

  • 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-10T17:35:34+00:00Added an answer on June 10, 2026 at 5:35 pm

    Yes. Use a join.

    select emp_num, first_name, last_name, amount
    from 
        table1 
           inner join table2 on table1.id = table2.table_1_id
           inner join table3 on table1.table_3_id = table3.id
    where
        effective_date between '2012-01-30 12:00:00' and '2012-03-01 12:00'
    and 
        acc_name = 'Over Pay'
    

    There is no 30th of February.

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

Sidebar

Related Questions

I have created two tables & inserted values as shown below . Table 1
I have two MySql tables as shown below with the data shown: CREATE TABLE
I have two tables as shown below The master Table ID keyword_tags ----------- ---------------------------------------------
I have two database tables with some demo data like shown below Create table
I have 4 tables like shown below Table: leave_request +------------+----------+--------------+------------+----------------------+ | request_id | staff_id
I have a table as shown below. It has accounts of type Fixed and
I have a table as shown below Q_ID DeptID EmployeeName City 100 100 testest
I have three tables as shown in below image. Note: Lead column of projectheader
I do have a table data as shown below: <td> <label for=title>Title : </label>
I have a table withe different columns as shown below Ref Number Service Numbers

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.