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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:21:38+00:00 2026-06-12T09:21:38+00:00

I am currently working on a project to I fetch some information from an

  • 0

I am currently working on a project to I fetch some information from an API and store it in a database. The table structure looks something like this:

id      ident aircraft_type  origin  destination  timestamp        departure_time
1      AWE1843      A321      KATL     KCLT    2012-10-04 10:46:34  2012-10-04 10:01:00 
2      ASQ5758      CRJ2      KATL     KIAD    2012-10-04 10:51:11  2012-10-04 09:40:00     
3      AAL2404      B738      KLAX     KDFW    2012-10-04 10:46:13  2012-10-04 08:23:00     
4      AAL2400      B738      KLAX     KDFW    2012-10-04 09:54:13  2012-10-04 07:31:00     
5      UAL912       B752      KLAX     KJFK    2012-10-04 10:19:24  2012-10-04 05:39:00
6      DAL1162      B752      KLAX     KCLT    2012-10-04 09:38:00  2012-10-04 04:44:30 

The six rows are for demonstration purposes; I have around 500 rows of such data. The application I am working on will ask the user to provide the two origin points and will provide the user with all the common destinations between those two origins.

For example, if a user enters “KATL” and “KLAX” as origin airports, the query displays the common destination between the two origins which is “KCLT”.

I tried different approaches to fix the issue but cannot get the desired functionality achieved. I tried joins and different ActiveRecord methods to no use.

  • 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-12T09:21:39+00:00Added an answer on June 12, 2026 at 9:21 am

    Something like this will work it will give you both tables though, you can use s.* or e.* to pick specific table if you need to:

    select * from (select * from flights where origin = 'KATL') s
    inner join (select * from flights where origin = 'KLAX') e
    on e.destination = s.destination;
    

    If you just want to display destinations:

    select distinct s.destination from (select * from flights where origin = 'KATL') s
    inner join (select * from flights where origin = 'KLAX') e
    on e.destination = s.destination;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working on a php/javascript project which retrieves information from a database
Currently working on a project to upgrade our Goole Maps API from v2 to
I'm currently working on a project where I hide/show some table rows based on
I am currently working on a project that is looking at having a database
I'm currently working on a project in which i need to read some (Latitude,
First, some context: I'm currently working on a project in which I use the
Currently I am working on my exam project and I require some assistance. The
I'm currently working on a migration project, to migrate data from the old db
I'm currently working on project with Haskell, and have found myself some trouble. I'm
I am currently working on a project that is moving from .NET 2.0 to

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.