question

parmida avatar image
parmida asked

sql different resulr

i have two tables , destinations and logs. i want to get the sum of the amount that was used in transfer type paya that is in destinations table.when i get the sum without join from destinations it give me 365 but when i join it with table logs on request-id it give me another result i want to know why. 

select sum(amount) from destinations where pay_date >='13991201' and pay_date <'14000101' and transfer_type = 'paya' and state = 'success';

select sum(amount) from destinations join logs on destinations.request = logs.request where pay_date >='13991201' and pay_date <'14000101' and transfer_type = 'paya' and state = 'success';

in my request field in logs they have null value too.





query-results
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

· Write an Answer

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.