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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:20:31+00:00 2026-06-07T15:20:31+00:00

This is for a game I’m developing. I have a MySQL table with each

  • 0

This is for a game I’m developing.
I have a MySQL table with each player entity that contains the id of the weapon they hold in each hand for example:

player id, playername, rhand, lhand,
1          Guy         1      2
2          OtherGuy    3      2

and I have an items table containing information about each item by id

item  name   damage_type
1     hammer crush
2     shield none
3     sword  slash

when resolving combat on my server I search for each player by id one is the attacker and one is the defender I would like to return a result with each players weapon name and perhaps a property of the weapon (i.e. damage_type above) on the same line so I’d like results like this

player id playername rhand lhand   rhand_damage_type lhand_damage_type
1         Guy        hammer shield crush             none
2         OtherGuy   sword  shield slash             none
  • 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-07T15:20:33+00:00Added an answer on June 7, 2026 at 3:20 pm
    SELECT p.player_id, p.player_name, w1.name, w2.name, w1.damage_type, w2.damage_type 
    FROM players p, weapons w1, weapons w2 
    WHERE p.player_id = attackerId OR p.player_id=defenderId
    AND p.rhand = w1.item 
    AND p.lhand = w2.item
    

    In case the plyers might also miss one or both weapons:

    SELECT DISTINCT player_id, player_name, w1.name, w2.name, w1.damage_type, w2.damage_type 
    FROM 
    (SELECT player_id, player_name, name, damage_type 
     FROM players LEFT JOIN weapons on rhand = w1.item 
     WHERE p.player_id = attackerId OR p.player_id=defenderId) as w1,
    (SELECT player_id, player_name, name, damage_type 
     FROM players LEFT JOIN weapons on lhand = w2.item 
     WHERE p.player_id = attackerId OR p.player_id=defenderId) as w2
     Were w1.player_id = w2.player_id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this game, that contains a lot of text as speech. I would
I have this game where balloons are coming from bottom and player has to
I'm developing a Flash game in ActionScript 2, and the issue if that this
Support we have an n * m table, and two players play this game.
I have made this game for Mac OS, but I realised that i need
I'm implementing a card game. In this game I have a Board that is
I am developing a game for Android. This game is Pacman, I have seen
I am developing the game that named Lights Out . So for solving this,
So I have this game database, where I have several users with fields, id,
I have this game with some variety of textures. Whenever I draw a texture

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.