ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I'm not that familiar with sql. Here's my situation. I'm running mysql, and I have a table of every Batter from the 2003 Baseball season. Each record contains playerID, teamID, games, hits etc. The problem is that some players were traded in midseason last year so there are 2 records for those players, one for their stats from team 1 and one from their stats from team 2. Is there a way in SQL to combine two records? All the fields I need to combine would be small integers.
Alternatively I could combine them after extracting them from the database, but I was just wondering if I could do it through SQL. Thanks for any help.
Thanks for your help, but I'm getting the following error:
mysql> SELECT playerID, SUM(G), SUM(H), SUM(SB) FROM Batting WHERE playerID='sanchal03';
ERROR 1140: Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is illegal if there is no GROUP BY clause
I'm not sure if this will help, but here is how the Table is setup: