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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:05:09+00:00 2026-05-25T11:05:09+00:00

What I am trying to do is make a query so I can make

  • 0

What I am trying to do is make a query so I can make the fights table more readable.
So Fighter 1 would pull the id of 1 from the fighters table, and Fighter 2 would do the same thing. Winner is either 0, 1, 2. Zero means it is a draw, and then 1 means that Fighter 1 won and 2 means that fighter 2 won.

The query I tried so far:

SELECT CONCAT(first_name, ' ', last_name) 'Fighter 1', 
       CONCAT(victory_method.name, ' (', method_notes, ')') 'Victory' 
  FROM fights 
  JOIN fighters ON fights.fighter1_id = fighters.id
  JOIN victory_method ON fights.victory_method_id = victory_method.id

enter image description here

Now that is a good start, but what I need is to figure out how to get Fighter 2 listed on there as well, and then also the Winner, either if it was a Draw or fighter 1 or 2 who won.

  • 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-25T11:05:10+00:00Added an answer on May 25, 2026 at 11:05 am

    inner Join fighters table again, using alias as

    SELECT 
    CONCAT(fo.first_name, ' ', fo.last_name, if (fights.winner=1, "Winner", "Loser")) 'Fighter 1', 
    CONCAT(ft.first_name, ' ', ft.last_name, if (fights.winner=2, "Winner", "Loser")) 'Fighter 2', 
    CONCAT(victory_method.name, ' (', method_notes, ')') 'Victory' 
    FROM fights 
    INNER JOIN fighters as fo ON fights.fighter1_id = fo.id
    INNER JOIN fighters as ft ON fights.fighter2_id = ft.id
    INNER JOIN victory_method ON fights.victory_method_id = victory_method.id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to figure out how I can make a query with MySQL
I am trying to make a simple query to a small MYSQL table, but
I am trying to make an MDX query that can tell me how many
I'm trying to make a query where my LIKE can match any field in
I'm trying to make a PIVOT-query out of a working table with the structure:
I am trying to make a Linq to Entities Query working but I can't
I'm trying to make a Linq query that will retrieve a string value from
I'm trying to make query in a table that has a column named First
I am trying to make a query to get data from a database, but
I am trying to make a function I can pass an mysql query into

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.