I'm new to geographic SQL queries. I have two tables; [station_information] which describes bicycle rental stations with a geography type spatial column, and [bike_rides] which has information on a trips on rental bikes.
[station_information] has station_id as a primary key, and [bike_rides] has to_station_id and a from_station_id column referencing the starting and ending stations of the bike trips. I want to create a distance column in [bike_rides] with the distance between the from_station_id and to_station_id for every record.
How do I go about doing this? I know I have to join the tables and use STDistance, but I don't know to us it. Every example of STDistance I've looked up creates variables for the start and end points and uses STGeomFromText to create the point, or uses the spatial columns from two different tables. Any help would be appreciated.