Jump to content

Recommended Posts

MySQL client version: 5.0.33

 

Statement:

REPLACE INTO teamdata_table1 (Number, TeamPlayerID, player_statsFirstname, player_statsLastname, player_statsAge, player_statsFitness, player_statsSpeed, player_statsStrength, player_statsHandling, player_statsAttacking, player_statsTackling, player_statsTactics, player_statsPassing, player_statsImage, player_statsTeamID) 
SELECT counttotwenty.number, player_statsID, player_statsFirstname, player_statsLastname, player_statsAge, player_statsFitness, player_statsSpeed, player_statsStrength, player_statsHandling, player_statsAttacking, player_statsTackling, player_statsTactics, player_statsPassing, player_statsImage, player_statsTeamID 
FROM player_stats, counttotwenty 
WHERE player_stats.player_statsTeamID='1';

 

Hi all,

What I wanna do with the above code is refresh a table (teamdata_table1) with information from tables player_stats and counttotwenty. Table counttotwenty is one column - the numbers 1 to 20. Table player_stats is the statistics of 20 players - 14 columns. Table teamdata_table1 is a mixture of both, with 15 columns - the column from counttotwenty marking the player number in column 1, and columns 2-14 are the player data.

 

When I run the query, it runs OK, and displays the info from table counttotwenty (ie, a column showing numbers 1 to 20) but the rest of the table only shows info from player with playerstatsID of 20.

 

All I would like to do is pack everything from the 2 tables into teamdata_table1, and have it refresh each time I run the script. Can anyone see what I'm doing incorrectly?

 

All help appreciated!

 

Cheers - woolyg

 

 

Link to comment
https://forums.phpfreaks.com/topic/47974-replace-into-issue/
Share on other sites

Thanks,

I've pared it down to the following code:

 

SELECT * FROM counttotwenty INNER JOIN player_stats 
WHERE player_stats.player_statsTeamID='1';

 

..and what I'm getting is this:

 

mysql1.gif

 

 

But what I'd really like is this (excuse the patched together image):

 

mysql2.gif

 

..showing player details in columns 2-15 for 20 rows, with the numbers 1-20 in column 1. So basically, I'd like not to have duplicated player entries.

All info appreciated again - thanks.

 

Woolyg

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/47974-replace-into-issue/#findComment-234487
Share on other sites

Sorry for the confusion.

 

I want to achieve a table of 20 players from a certain team to be populated, displayed by number.

 

If I select all players from a certain team, it displays their stats fine. When I try to incorporate numbering their entries from 1 to 20, thats where I'm hitting the wall..

Link to comment
https://forums.phpfreaks.com/topic/47974-replace-into-issue/#findComment-234501
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.