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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:44:00+00:00 2026-06-04T05:44:00+00:00

I have two table one table containing station id and station name, and another

  • 0

I have two table one table containing station id and station name, and another table containing id, name, startStationId, endStationId. I know second table’s id by using that id i need to fetch all details of second table with station name for corresponding startStationId, endStationId.

ex: table1
---------------------------------
slNo staionId staionName
---------------------------------
1     0012     Bangalore ,
2     0014     Chennai ,
3     0015     Mumbai
---------------------------------

Table 2:
------------------------------------------
Id   Name    startStationId   endStationId
-------------------------------------------
123  Dhinesh   0014             0015
-------------------------------------------

For example i know second table id(123).. so i want to fetch all results by using id, result would be.

Id =>123, Name => Dhinesh, StartStaion =>Chennai , Endstation=>Mumbai.

How can we write in one single query…?

Thanks in advance.

  • 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-04T05:44:01+00:00Added an answer on June 4, 2026 at 5:44 am

    Try this.

    SELECT t2.Id,t2.name,t1.StationName,t3.StationName
    FROM table2 t2
    INNER JOIN table1 t1 ON t2.startStationId = t1.stationId
    INNER JOIN table1 t3 ON t2.endStationId = t3.stationId
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two mysql tables: Item containing items that one can buy: CREATE TABLE
I have two large tables in MySQL, one containing about 6,00,000 records and another
I have two models. one is brand and another is product_detail. brands table has
I have three tables, table one (tableA) containing users data like name and email,
I have an issue with a table containing three cells in one row. Two
I have one table [table] with two columns that needs to be filtered: [column1]
So I have a table with only two columns and one row. The second
Is there a way to have one table that is split in two, or
i have one excel file and that is containing price column.. now i need
I have a mysql table with two columns - one containing a year in

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.