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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:15:44+00:00 2026-06-14T03:15:44+00:00

I have three tables like this: Specialisation sid | s_name ————– 1 | test

  • 0

I have three tables like this:

Specialisation

sid | s_name
--------------
 1  | test 1
 2  | test 2  

Person

pid | name | sid
------------------
 1  | ABC  |  1
 2  | XYZ  |  2

Timing

tid | time_from | time_to  | pid
----------------------------------
 1  | 08:00:00  | 10:00:00 |  1
 2  | 20:00:00  | 22:00:00 |  1
 3  | 09:00:00  | 14:00:00 |  2
 4  | 19:00:00  | 20:00:00 |  2

**I want to get result something like this*

pid | name | s_name | time_from  | time_to
--------------------------------------------
 1  | ABC  | test 1 | 08:00:00   | 10:00:00

Description:
All three tables are connected.
I want all records where
specialisation id = ‘1’
person name Like ‘ABC’
timing is in between ’08:00:00′ and ’10:00:00′.

I tried several combinations of mysql joins but not able to fetch the data correctly.

  • 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-14T03:15:46+00:00Added an answer on June 14, 2026 at 3:15 am

    You can use INNER JOIN for this,

    SELECT  a.pid, a.name,
            b.sname,
            c.time_from,
            c.time_to
    FROM    person a
            INNER JOIN specialisation b
                ON a.sid = b.sid
            INNER JOIN Timing c
                ON a.pid = c.pid
    WHERE   a.sid = 1 and 
            a.name='ABC'  AND 
            c.time_from >= '08:00:00' AND c.time_to <= '10:00:00'
    
    • SQLFiddle Demo
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three tables like this: Person table: person_id | name | dob --------------------------------
I have three tables like this: Person id | name | location ----------------------- 1
I have three tables like this: Table 1 structure: Name: registered_applicant_details Fields: applicant_id INT
If I have three different tables like this table_1 Field 1: victories Field 2:
I have three tables: videos, videos_categories, and categories. The tables look like this: videos:
I have three tables: Campus Building Floor and table structure is looks like this:
I have three tables and they look like this: users_table categories_table depart_table u_id cid
I have three tables...users, user_info, and quota_levels. They look like this: CREATE TABLE users
I have three tables in my Crystal Reports and it looks like this: Property
I have three tables: page, attachment, page-attachment I have data like this: page ID

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.