Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

adding a column

Codes here !

Moderators: macek, egami, gesf

adding a column

Postby beefsack » Thu Feb 06, 2003 10:58 pm

ok, say i had a db which had a playerID field and a score field. say the playerID isnt a primary key and there is multiple instances of it. if i did "SELECT score FROM table WHERE playerID=4" it might return multiple results. how would i get a total of score instead of multiple results? i hope that made sense :P
beefsack
New php-forum User
New php-forum User
 
Posts: 5
Joined: Wed Dec 11, 2002 6:32 pm
Location: Australia

Postby Redcircle » Fri Feb 07, 2003 2:53 am

SELECT sum(score) FROM table WHERE playerID=4
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Postby beefsack » Sun Feb 09, 2003 2:57 pm

thanks a ton :D thats perfect
beefsack
New php-forum User
New php-forum User
 
Posts: 5
Joined: Wed Dec 11, 2002 6:32 pm
Location: Australia


Return to mySQL & php coding

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.