Two columns in one table are displayed with results associated with a column in another table

Source: Internet
Author: User

Station table

Column Name:

StationId-----Site Number

Stationlon----Site Longitude

Stationlat----Site Latitude

Record table

Column Name:

Recorkid---------Record number

stationgoid------Lending a site number

Stationbackid----Return the site number

Query Results Display columns:

Stationgoid-----Lending a site number

Gostationlon----Loan Site Longitude

Gostationlat----Lending a site latitude

Stationbackid---Return the site number

backstationlon--return site Longitude

Backstationlat---Return the site latitude

1 SelectR.stationgoid,s1.stationlon asGostationlon,s1.stationlat asGostationlat,2R.stationbackid,s2.stationlon asBackstationlon,s2.stationlat asBackstationlat3  fromRecord asR,station asS1,station asS24 whereR.stationgoid=S1.stationid andR.stationbackid=S2.stationid

SQL query Results:

Two columns in one table are displayed with results associated with a column in another table

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.