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

  • Home
  • SEARCH
  • 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 722345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:58:44+00:00 2026-05-14T05:58:44+00:00

I an SQL SELECT statement I need to extract the name of two teams,

  • 0

I an SQL SELECT statement I need to extract the name of two teams, taking both teams from the same table. Eg Below

SELECT sport_activity_id, (team A), (team B), date, time 
FROM sportactivity, teams 
WHERE competition_id_fk = 2

For (team A) and (team B) I have an team_id, which is a FK for the table ‘teams’

Is it possible to get the following result from these tables by SQL?
1, Barcelona, Arsenal, 01/01/2000, 20:00

the two table are the following:

table sportactivity

sport_activity_id, home_team_fk, away_team_fk, competition_id_fk, date, time

(tuple example) -> 1, 33, 41, 5, 2010-04-14, 05:40:00

table teams

team_id, team_name

(tuple example) -> 1, Algeria

  • 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-05-14T05:58:44+00:00Added an answer on May 14, 2026 at 5:58 am

    Yes, you just need to join with teams twice:

    SELECT sport_activity_id, T1.team_name, T2.team_name, date, time 
    FROM sportactivity
    JOIN teams T1 ON home_team_fk = T1.team_id
    JOIN teams T2 ON away_team_fk = T2.team_id
    WHERE competition_id_fk = 2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following SQL-statement: SELECT DISTINCT name FROM log WHERE NOT name =
I have a SQL statement that looks like: SELECT [Phone] FROM [Table] WHERE (
I have the following SQL Statement. I need to select the latest record for
Here's my current SQL statement: SEARCH_ALBUMS_SQL = SELECT * FROM albums WHERE title LIKE
Which SQL statement is faster? SELECT TOP 2 c1.Price, c2.Price, ..... c49.Price, c50.Price FROM
i have sql statement like this SELECT DISTINCT results_sp_08.material_number FROM results_sp_08 INNER JOIN courses
How do I perform an IF...THEN in an SQL SELECT statement? For example: SELECT
What is the difference between HAVING and WHERE in an SQL SELECT statement? EDIT:
How do you make a field in a sql select statement all upper or
I was reviewing some SQL queries and I saw a select statement that looked

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.