SitePoint Sponsor

User Tag List

Page 3 of 3 FirstFirst 123
Results 51 to 54 of 54
  1. #51
    SitePoint Guru
    Join Date
    Apr 2007
    Posts
    690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks everyone for the help I got it working now

  2. #52
    SitePoint Wizard bronze trophy devbanana's Avatar
    Join Date
    Apr 2006
    Location
    Pennsylvania
    Posts
    1,736
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by spikeZ View Post
    Are you sure? I tested it on a simple table with 3 columns and it worked fine....

    Might be time to hoof this thread over to the mysql forum....
    Positive. I'm using MySQL 5.0.37, so maybe there's a difference? i don't know.

    Code:
    mysql> create table test (id int unsigned not null auto_increment, n1 int unsigned not null, n2 int unsigned not null, n3 int unsigned not null, primary key (id
    ));
    Query OK, 0 rows affected (0.02 sec)
    
    mysql> insert into test (n1, n2, n3) values(1, 2, 3), (4, 5, 6), (7, 8, 9);
    Query OK, 3 rows affected (0.00 sec)
    Records: 3  Duplicates: 0  Warnings: 0
    
    mysql> select sum(n1, n2, n3) from test;
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' n2, n3) from test' at line 1
    mysql>
    Laudetur Iesus Christus!
    Christ's Little Flock
    Jesus is the Good Shepherd

  3. #53
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    that might be because I used a slightly different syntax DB
    Code:
    select sum(n1+n2) as total from test;
    see if that makes a difference.
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  4. #54
    SitePoint Wizard bronze trophy devbanana's Avatar
    Join Date
    Apr 2006
    Location
    Pennsylvania
    Posts
    1,736
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ah, yes then; that'll add together all the columns then all of the rows. That works.
    Laudetur Iesus Christus!
    Christ's Little Flock
    Jesus is the Good Shepherd


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •