SQL Query

Closed
smd - Jan 29, 2009 at 06:48 AM
maniktozor Posts 8 Registration date Wednesday November 5, 2008 Status Member Last seen May 18, 2009 - Jan 30, 2009 at 12:36 AM
Hello,
have got a query in sql

members contribution certain money at different periods...after some time they withdraw that money which was invested.

i need to sum up the members and exlcude the members which show zero values.

example

member id investment withdrawal
1 1000
2 2000
3 500
1 1000
2 1000
4 1000
5 200

the query should add all the investment by member id and substract all the withdrawals...and only those greater than zero should be displayed.
per the above table we the query result shoudl display
2 1000
3 500
4 1000
5 200

thanks alot...

1 response

maniktozor Posts 8 Registration date Wednesday November 5, 2008 Status Member Last seen May 18, 2009
Jan 30, 2009 at 12:36 AM
hi,
try this link to get tutorials about using the SQL:
https://www.w3schools.com/sql/default.asp
0