Jump to content

Recommended Posts

i ve never used mysql this is what i would like to do

 

on the picture there is a column tm_country HUN and  an other named tm_extension at the present there is a gif representing the country hungary flag, now there are 5000 rows with HUN and i have a hard time copying and pasting the gif into each single row

 

would you please help me with a query that would paste hassal-132.gif in each row whose contry is HUN (hungary)

 

 

the name of the table as shown on the picture is ebo_sb_teams

 

 

 

 

thank you for your help

Don't do that.

 

Have a "flag" table which contains records with code and image name for each country. Job done.

|  tm_country   |    image_name    |
+---------------+------------------+
|     HUN       |   hassal-132.gif |

When you query the first table, JOIN to the flag table using the country code

If it exists then use it.

 

You have the table that associates HUN with hassal132.gif, so why put "hassal_gif" into another 5000 records? You only need it the once. That is whole point of using a relational database.

 

http://lmgtfy.com/?q=data+normalization

because normally i am suppose to enter a flag for every single player coming from lets say hungary but when i enter it from the back end of my site; the file changes name.... so i ve noticed that by pasting the same name on all the field i achieve the same results that is why i need a sql commande that would paste it for me and i have never seen sql commande

it display hungarian flag on all the players so that is why i need the sql thing

 

i ve never used sql i am not a programmer i just need a query

 

 

barand could you help me with the sql file?

 

 

UPDATE ebo_sb_teams

SET tm_extension='hassal-132.gif'

WHERE tm_country='HUN';

 

 

would this kinda line do the trick?

Edited by Ch0cu3r

I know I could have given you that same query at the start, but in the long run I wouldn't be doing you any favours teaching you how to build db tables that are like spreadsheets. That isn't what relational databases like mysql are for.

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.