2

In a sql table how to adding array of numbers fetched from sql table

Table like given below

   Id         country       Person        Money

   1           UK           john          2010
   2           USA          Henry         120
   3           RUS          neko          130
   4           GER          suka          110
   7           CAN          beater        1450
   8           USA          lusi          2501

This the table How to add a array Money without USA.

I want the addition money from table without USA

$Totalmoney=2010+130+110+1450;

sql coding fetching without USA Rows then how to add those money values without USA

SELECT Id,country,Person,Money  
FROM Customers   
WHERE country !="USA";
1
  • 1
    what is your expected output..your question is not clear? Commented Jul 19, 2013 at 10:45

3 Answers 3

1
SELECT sum(Money)
FROM Customers   
WHERE country !="USA";
Sign up to request clarification or add additional context in comments.

Comments

1

very simple use the not equal operator !=

SELECT ID,country,Person,money  
FROM Customers   
WHERE country != "USA";

Comments

1
SELECT SUM(Money)
FROM Customers   
WHERE country !="USA";

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.