Re: Re: question about columns in a table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In message <fglirt+bu5a@xxxxxxxxxxx>, Sudhakar <finals27@xxxxxxxxx>
writes
>as suggested not to create a field which would add the numeric 
>values in the tables, i used the select sum query however it does 
>not work.
>The table has 2 fields defined as aboutus & contactus as integer. In 
>this case as i will be updating the columns every time there is a 
>visit, this table will only have 1 row at all times. Is it because 
>of this the query is not being executed.
>
>$count="SELECT SUM(aboutus, contactus) FROM visits"; 

SELECT aboutus + contactus FROM visits;

If you think of it like a spreadsheet, SUM works *down* the columns, and
you need '+' to go across.

-- 
Pete Clark

Sunny Andalucia
http://hotcosta.com/Andalucia.Spain

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux