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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:44:08+00:00 2026-05-17T16:44:08+00:00

The query below fetches the wageTypeID based on the current active hiring info record

  • 0

The query below fetches the wageTypeID based on the current active hiring info record and salary record.

  SELECT wt.wageTypeID
    FROM TimeSheet t 
  INNER JOIN Employee e ON e.employeeID = t.employeeID
  INNER JOIN Salary s ON s.salaryID = t.salaryID
  INNER JOIN Wage w ON w.wageID = s.wageID
  INNER JOIN EmpHiringInfo ehf ON ehf.EmpHiringInfoID = s.EmpHiringInfoID
  INNER JOIN WageType wt ON wt.wageTypeID = w.wageTypeID
  WHERE ehf.employeeID = 300  
    AND ehf.isActive = 1 
    AND s.isActive = 1

The above query should return the value 15! I wonder where did i go wrong?


Here is the schema of the joined tables:

TimeSheet:
timeSheetID
employeeID - 300
salaryID
.
.

Salary:
salaryID
EmpHiringInfoID
wageID
isActive - true
.
.

WageType:
wageTypeID - 15
wageTypeTitle - Hourly

Wage:
wageID
wageTypeID - 15
wageAmount - $11


EmpHiringInfo:
EmpHiringInfoID
employeeID
isActive - true
.
.

The isActive in Salary is only and only True for one record. Same thing applied to
EmpHiringInfo.

  • 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-17T16:44:08+00:00Added an answer on May 17, 2026 at 4:44 pm

    Without an actual data dump (and the create table statements), we can’t exactly say because we can’t see your data. So here’s how to approach the situation so you can find out where the issue is:

    1. Scale back the SELECT statement to have no JOINs–you want to make sure the base table returns the record(s) you need before going any further.
    2. Add a JOIN, one at a time. Each JOIN you add, you need to check the resultset to see that the rows you’re expecting are still visible. If a JOIN has more than one criteria (IE: ehf), then again–incrementally add criteria while checking every time.

    Eventually, the criteria that is causing the issue will become obvious and so you’ll have to review how to handle the situation. It’s possible more than one JOIN is causing troubles, and you might not see the others until after one is addressed.

    I recommend restructuring your query to use the table you’re selecting the most data from in the FROM clause. In this case, that means:

    SELECT wt.wageTypeID
      FROM WAGETYPE wt
    

    That will make adding JOINs easier.

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

Sidebar

Related Questions

The query below fetches a subset of rows from a table starting at row
The query below: SELECT i_adgroup_id, i_category_id FROM adgroupcategories_br WHERE i_adgroup_id IN ( SELECT i_adgroup_id
I use the below code to fetch a particular record from sqlite. public String
I have the query below that fetches 500 records according to certain criteria. The
I have a linq query which fetches all records from the customer table to
I am outputing 4 columns from a mysql query, but using the code below
I have a Linq query that fetches data from database. The problem is I
I have a basic query below where it searches a question from the database
The query below returns rows that have both loginid and ip2 in the bumps
If the query below returns a 'template' id for any template assigned to a

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.