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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:07:21+00:00 2026-06-08T12:07:21+00:00

I have the following database tables, which hold information about a public transport system:

  • 0

I have the following database tables, which hold information about a public transport system:

  • Stations (id, name)
  • Ride(id, lineName)
  • RideStop(rideId, stationId, sequenceNumber, arrivalTime, departureTime)

The RideStop has references to Ride and Station. When ordering the RideStops by sequenceNumber, you get the path of this specific ride.

I need to get the paths from all rides, which leave from a specific station.
I can get the complete paths by executing

select * 
from ridestop rs 
where rs.ride in (
  SELECT ride FROM ttm.ridestop where stationid = 8503000
)

However, I do not care where a ride came from, only where it goes to.

Question:
How can I limit the result to only the remaining part of the rides, beginning at station 8503000?

  • 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-08T12:07:22+00:00Added an answer on June 8, 2026 at 12:07 pm

    The following query uses a subquery to the sequence number of each station on the ride. It then joins this back to the ride stop to choose everything from the ride on or after that sequence number.

    select rs.*
    from ridestop rs join
          (SELECT ride, rs.sequenceNumber
           FROM ride r join
                ridestop rs
                on r.ride = rs.ride
           where stationid = 8503000
          ) r
          on rs.ride = r.ride and
             rs.sequenceNumber >= r.sequenceNumber
    order by rs.ride, rs.sequenceNumber
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following (simplified) database tables: Products - ProductID, int, PK - Name,
I have the following two tables in my mysql database. Table Name: groups id
I have the following database table with information about people, diseases, and drugs: PERSON_T
I have the following bit of PHP code, which creates three database tables, then
I have the following listbox below which binds to a database table of image
I have two database tables with the following structure: actions: action_id int(11) primary key
I have three mysql table from same database Db1. Three tables have following columns.
I have the following tables in my database: Products ID_PRODUCT PRODUCTNAME PRICE Customers ID_CUSTOMER
I have the following tables in a database (i'll only list the important attributes):
I have the following tables, with these keys in my database: bookings session_id sessions

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.