Jump to content
pessantiago

sql somar valores

Recommended Posts

pessantiago

Calculo financeiro

tenho duas tabelas com 

valores recebidos e pagos a clientes....

Quero saber como posso ver quais sao os 10 melhores que mais lucro dão

Como posso fazer se tiver apenas valores recebidos de um determinado cliente

 

coluna recebido

a,20

a,15

b,30

 

coluna pagamento

b, 30

 

output seria algo 

a ,35

b, 0

 

Edited by pessantiago

Share this post


Link to post
Share on other sites
M6

Para os 10 com maior lucro fazes um "select top 10 sum(coluna) ...".

Para a segunda, fazes um left join entre as tabelas.


10 REM Generation 48K!
20 INPUT "URL:", A$
30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50
40 PRINT "404 Not Found"
50 PRINT "./M6 @ Portugal a Programar."

 

Share this post


Link to post
Share on other sites
M6

Então tens de explicar de forma mais clara os erros ou as dúvidas que tens.


10 REM Generation 48K!
20 INPUT "URL:", A$
30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50
40 PRINT "404 Not Found"
50 PRINT "./M6 @ Portugal a Programar."

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.