SUM of 2 columns in 2 tables THIS IS REALLY SIMPLE

  • Sean Lange

    SSC Guru

    Points: 286366

    maher_guida - Tuesday, June 26, 2018 4:23 PM

    Luis Cazares - Tuesday, June 26, 2018 12:50 PM

    maher_guida - Tuesday, June 26, 2018 12:25 PM

    how ican make 3 sum function in same select query from 3tables
    and there is  relation the problem is sum come wrong numbers and  one of the sum come null I want it 0  to complet calculations
    look 

    I have three tables
    types
    bills_in
    bills_out
    iwant sum(bills_in.[quantity]),sum(bills_out.[quantity]),(bills_in.[quantity])-sum(bills_out.[quantity]) as rest

    group by types.name
    and sometimes su(bills_n.[quantity]) null  then will give me the result of (bills_in.[quantity])-sum(bills_out.[quantity]) as rest null
    I am using oledb/ace12
    what I can do ?????

    Start by creating a new thread and read the articles on my signature to learn how to get better help.

    what do u mean I cant understand u

    What part don't you understand? You should start a new thread, not take over an old one. And when you post you need to provide details, not just a vague description of your requirements.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

Viewing post 16 (of 16 total)

You must be logged in to reply to this topic. Login to reply