Show accounts with 0 balance report

Hello
My problem is the following. I am creating a budget report that will show me accounts and what is their current value.
I have a lot of lines that have an account (about 10 different). Each line has an amount of spend on it. Let's say like this

ROW_ID, ACCOUNT_ID, VERSION_ID, TYPE, AMOUNT
------------------------------------------------------------------------------
1 2 3 O 100
2 3 3 O 90
3 2 3 O 120
4 1 3 D 1030
5 2 2 O 10
6 4 1 D 190

MBB this is a simplified version.

What I am looking for is the sum of all accounts where type = O id and version = 3.
BTW, O is for (the 'operation')
What I get is
ACCOUNT_ID, TYPE, QUANTITY
--------------------------------------------
2 O 220
3 O 90

What I want is

ACCOUNT_ID, TYPE, QUANTITY
--------------------------------------------
1A 0
2 O 220
3 O 90
4A 0

To put words to Acoount_id 1 version_id 3 and where row_type is O there are no cost.
But if you change the type "D" and leave the version 3, the result would be:
ACCOUNT_ID, TYPE, QUANTITY
--------------------------------------------
1 1090
2 D 0
3 D 0
4 D 0


That's what I have right now.
SELECT KVF. ACCOUNT_ID,
SUM (KVF. BDGT_SUM BDGT_SUM),
MAX ('TRANSACTIONS') TYPE,
KVF. VERSION_ID
Of
K_VIEW_FULL KVF,
C EXPECTED
WHERE
AND KVF. VERSION_ID = 30
AND C.OP_DEV = ID C.CLASSIFICATOR
AND UPPER (K.NAME_SHOW) = UPPER ('Operation')
KVF GROUP. ACCOUNT_ID, KVF. VERSION_ID;

I know I should use joins some how, but I do not know how

Try this example:

with your_table as (
 select 1 ROW_ID, 2 ACCOUNT_ID, 3 VERSION_ID, 'O' TYPE, 100 AMOUNT from dual union all
 select 2, 3, 3, 'O', 90  from dual union all
 select 3, 2, 3, 'O', 120 from dual union all
 select 4, 1, 3, 'D', 1030 from dual union all
 select 5, 2, 2, 'O', 10 from dual union all
 select 6, 4, 1, 'D', 190 from dual
)
select  all_accounts.account_id
       ,sums.sum_amount
from
     (select distinct account_id from your_table) all_accounts
     left join (
                select account_id,
                       sum(amount) sum_amount
                from your_table
                where type = 'O' and version_id = 3
                group by account_id
               ) sums
               on all_accounts.account_id=sums.account_id
order by 1

Kind regards
Malakshinov Sayan

Tags: Database

Similar Questions

  • reporting on accounts with or without activities

    I need to create a report that contains the accounts with or without activities. The one that I chose in the reports only details ("activities") accounts section that contains some activities.

    I need the report not only with accounts that are already in contact, but also accounts which has not yet been contacted.

    Kind regards

    Dominik

    You must use the combined analysis.

  • Research of Trial Balance report. Help, please

    Hello guys,.
    I have a trial balance report that reports on more than one period (for example, between January and March).
    I am registered for the opening and the closing balance. Then included the total debits and credits for each period. I'd like to think I did it successfully and to the best of my knowledge.
    However for some codes, combinations, I see an opening balance (say 1 000 000), total appropriations 0, total debits 400 000 5 000 and closing balance. What I mean essentially is, the numbers don't seem to match. When I analyze the account survey GL the total debits and total credits are exactly as stated in my report. Can someone help me with this, or perhaps anyone with a query better. I'm doing this project on 11i.
    Thank you very much.

    Here's my post:

    create or replace function get_open_balance
    (p_code_combination_id number,
    p_set_of_books_id number,
    p_period_name in varchar2)
    Return number
    is
    v_open_balance number: = 0;
    Start
    SELECT
    NVL (sum(bal.begin_balance_dr-bal.begin_balance_cr), 0)
    IN v_open_balance
    OF gl_code_combinations_kfv cc
    gl_balances ball
    WHERE
    CC.code_combination_id = bal.code_combination_id
    AND cc.code_combination_id = p_code_combination_id
    AND bal.period_name = p_period_name
    AND bal.set_of_books_id = p_set_of_books_id
    ORDER by
    CC.concatenated_segments;
    Return v_open_balance;
    exception
    When no_data_found then
    return 0;
    while others then
    return 0;
    end get_open_balance;


    create or replace function get_close_balance
    (p_code_combination_id number,
    p_set_of_books_id number,
    p_period_name in varchar2)
    Return number
    is
    v_close_balance number: = 0;
    Start
    SELECT
    NVL (sum (bal.begin_balance_dr - bal.begin_balance_cr +))
    Bal.period_net_dr - bal.period_net_cr), 0)
    IN v_close_balance
    OF gl_code_combinations_kfv cc
    gl_balances ball
    WHERE
    CC.code_combination_id = bal.code_combination_id
    AND cc.code_combination_id = p_code_combination_id
    AND bal.period_name = p_period_name
    AND bal.set_of_books_id = p_set_of_books_id
    ORDER by
    CC.concatenated_segments;
    Return v_close_balance;
    exception
    When no_data_found then
    return 0;
    while others then
    return 0;
    end get_close_balance;


    So here's my query:

    Select
    GCC.code_combination_id,
    GCC.concatenated_segments,
    GSOB.currency_code,
    GSOB. Name sob_name,
    gl_flexfields_pkg.get_description_sql (gcc.chart_of_accounts_id,
    4, gcc.segment4) account_description,.
    get_open_balance (gcc.code_combination_id, gsob.set_of_books_id,: p_period_from) opening_balance.
    NVL ((select sum (entered_cr)
    of gl_je_lines gjl
    where gjl.code_combination_id = gcc.code_combination_id
    and gjl.status = 'P '.
    and gjl.effective_date between to_date ('01-' |: p_period_from)
    and last_day (to_date ('01-' |: p_period_to))), 0) credit.
    NVL ((select sum (entered_dr)
    of gl_je_lines gjl
    where gjl.code_combination_id = gcc.code_combination_id
    and gjl.status = 'P '.
    and gjl.effective_date between to_date ('01-' |: p_period_from)
    and last_day (to_date ('01-' |: p_period_to))), 0) flow,.
    get_close_balance (gcc.code_combination_id, gsob.set_of_books_id,: p_period_to) closing_balance
    of gl_code_combinations_kfv CCG, gl_sets_of_books gsob
    where gsob.chart_of_accounts_id = gcc.chart_of_accounts_id
    and gsob.set_of_books_id = nvl (: p_set_of_books_id, gsob.set_of_books_id)

    Hello.

    Simple. User entered_dr or entered_cr. Allways never use accounted_dr or accounted_cr.

    Octavio

  • someone has opened an account with my personal information

    Hello, I want to report an abuse of data of a personal nature. someone opened the account with my personal data. I have my account ([removed for privacy]) is my real account on Skype. Someone abused my personal information and opened a fake profile, there are xxxxxxxxxxxxx. If necessary, I'll send your administrator to my personal documents.
    I ask this profile should be deleted because that adversely affect my privacy and my personal information misused.

    I ask for help.

    Thank you

    Please contact Skype customer service

    TIME ZONE - US EAST. LOCATION - PHILADELPHIA, PA, USA.

    I recommend that you always run the latest version of Skype: Windows & Mac

    If my advice helped to solve your problem, please mark it as a solution to help others.
    Please note that I usually do not respond to unsolicited private Messages. Thank you.

  • All my shortcuts on the desktop and start menu - all programs are showing up with blank windows pages icon.

    Original title: broken shortcut

    ALL my shortcuts on the desktop and start menu - all programs are showing up with blank windows pages icon and the name of the file and .lnk I uninstalled something and it happened that I tried system recovery and everything else that I uninstalled the States are back but this how can I solve this?

    Hello

    1. what changes have been made to your computer before the problem?

    Follow these steps and check if they help.

    Step 1:

    I would say you rebuild the icon cache and check if the problem persists.

    a. press the keyboard Windows logo key combination + R to bring up the Run dialog box.
    b. type cmd and press ENTER to open the command prompt window.
    c. in the command prompt window, type the following commands pressing ENTER after each line:
    Taskkill /f /im explorer.exe
    attrib-h "%userprofile%\Local Settings\Application Data\IconCache.db.
    del "%userprofile%\Local Settings\Application Data\IconCache.db.
    Explorer.exe

    d. this restart Windows Explorer and rebuild the cache icons as needed.

    Step 2:

    Test the issue in a new user account.

  • Problem with Top SQLs report

    Hello

    I have a big problem with Top SQLs reports, when I generate a report of high SQLs, SQL, the value text is not end, I know that there is a "The SQL text size" setting on the properties of the agent (this configuration is also on the collections setting ' Ta maximum size in characters of the short collects text of the SQL statement is ") on the two options , I've incremented the value of 256 (default) 1500, but when I generate the Top SQLs postpones continue it problem, once the changes I restarted the agent but the problem persists, I generate the report on the different formats, but result is the same, could you help me please.

    Thank you.

    Best regards.

    I see this in support KB article https://support.software.dell.com/kb/109536

    "

    • Title

      SQL in DB2 Top instructions are truncated in the delivered report of Top SQL

    • Description

      SQL in DB2 Top instructions are truncated in the delivered report of Top SQL

    • Resolution

    • Resolution A DDB-3673 request improvement with Support software Dell to show the full text of SQL high in the report Top SQL for DB2.

      Workaround At this point you should be able to make a custom report by cloning the Top SQL existing and then customizing report. »

    I know that this is not the solution, more of an explanation and guidance on how to solve this problem by using customizations.

    Golan

  • tried to create an account with xbox (software on my computer) and it won't let me download anything from there. Is there a setting I need to change or take it back to the store?

    I just bought a new laptop about 4 days ago. It came with 10 Windows. The problem I have is, it does not download anything. I tried to share a youtube video, and it wouldn't let me. I tried to create an account with xbox (software on my computer), and it won't let me download anything from here. Is there a setting I need to change or take it back to the store?

    Thank you

    Michelle

    Hi Michelle,

    Thanks for posting your query on the Microsoft Community.

    According to the description, I understand that you are unable to download anything.

    I would like to know some information.

    1. You are connected to the internet?

    2. You get no matter what error code or error message?

    Please check the date and time system and check if it is up-to-date.

    If it is not set correctly, please follow the link to change the date and time:

    http://Windows.Microsoft.com/en-us/Windows-8/clock-out-of-sync

    I suggest you follow the steps to run the internet connection Troubleshooter:

    Follow the steps below:

    (a) affects Windows and x together and select Control Panel.
    (b) click on troubleshooting.
    (c) click show all in the left side panel.
    (d) click on Internet connections.
    (e) follow the on-screen instructions to resolve this problem.

    Hope this information helps. Please let us know if you need any other help with Windows in the future. We will be happy to help you.

  • Upgrade to 8.1 fails "you must use an account with administrator privileges to install Windows 8.1." "Try loggin with the user of an administrator on this PC account and try the update again.

    Hello

    I have some difficulties to try to upgrade to windows 8... The computer asked me to go to 8.1, I click OK and it sends me to the store. Then I click on "Download Windows 8.1 Pro" and I get the message:
    "You must use an account with administrator privileges to install Windows 8.1." Try loggin with the user of an administrator on this PC account and retry the update", as shown in the attached picture.

    The thing is that I am the only administrator account.
    I also checked enable the built-in Administrator, by logging in and trying to here, but from the account built-in administrator is not aloud me to use Store.

    What can I do? Thank you

    Original title: upgrade Windows 8 Pro x 64 to Windows 8.1

    Hello

    I've read reports that uninstalling Windows Update KB2871389, and then put it back solves the problem.

    I read recently that this Fix - It might help...

    http://support.Microsoft.com/kb/971058/en-us

  • APTB does not not with GL balance

    Hello

    APTB balance sheet shows matching with GL high balance. Please help on this

    Hi user;

    "" For your question, I suggest farm your thread here that change the status of the thread to answered and move it to Forum Home "E-Business Suite ' Discussion General EBS
    that you can get a faster answer

    Respect of
    HELIOS

  • How can I add a map page in photo books that will show destinations with arrows like iPhotos used to do?

    In iPhotos, you can create a page of book that showed cards with your travel destinations. The kids loved because they can now see to what extent they traveled. This feature doesn't seem to be transported on the photos App updated. Can anyone explain why?

    You can add a map with markers places, but arrows like in iPhoto or Aperture are perhaps not available, because the pages with arrows caused constant crashes in iPhoto, who knows.

    As a workaround: you could create a map with location markers page and print the page in PDF format, and then draw the arrows in preview on the map and import the page map of pictures as a photo.  Add this photo to the photo book full page.

  • Update settings prevented the second office "an account with that name already exists...". »

    My provider has modernized and forces me to change the server settings. I did this successfully on a desktop computer and now I want to do this on the second and the third office where I want my accounts available e-mail.

    When I try, I get a window of the wizard account saying "an account with that name already exists. Please enter a different account name. "And I'm prevented from doing the settings made on the second Desktop server.

    How do I get around this?

    Thank you,
    DJBrewster

    Open the configuration editor and search for entries with this name

    There should be two entries with mail.server.serverXX.name (where XX is a number.) change on them and try and change the setting again.

  • I created an account with Hightail (and received and responded to the verification email) but when I click on the down arrow next to Lacrosse "join".

    I created an account with Hightail (and received responded to the verification email), but when I click on the arrow next to the button "join" the 'link' button does not appear.

    Have you added hightail in the menu (alt + T) tools > options > Annexes > out.

  • Some Excel files download but do not show associated with Excel or seem to have no file name extension.

    Some Excel files download but do not show associated with Excel or seem to have no file name extension. If I download these files using Internet Explorer, they open properly. I can add xls or xlsx file and it will open properly with Excel. If I select the file open the 'Open with' dialog box and I If select Excel, the file does not open at all... nothing happens and Excel does not open. The excel in the picture as an attachment file are those where I added the excel file name extension.

    Unfortunately, the way that Firefox gives the name of file is more literal and less improvisational than Internet Explorer, you may need to add this extension .xls or .xlsx yourself from time to time.

    If you want to do it in the shortest time, you can change the immediate download to ask you where to save the file, which also foresees the possibility to change the file name. If you want to try it, the setting is described here: start-up, homepage, tabs and download settings.

  • I just upgraded to Thunderbird 31.3.0 (on Windows 7). Now I can no longer launch Thunderbird. This shows only the Mozilla Crash Reporter every time.

    I just upgraded to Thunderbird 31.3.0 (on Windows 7). Now I can no longer launch Thunderbird. This shows only the Mozilla Crash Reporter every time.

    How do I recover from this?
    

    Is it possible to revert to a previous version?

    You can download the previous version of . mozilla.org and install it. After that revert to your previous version, you can check your incident reports to see what was causing the problem via help-> troubleshooting information...

  • Win7 with FF 31, smart phone 4.2 with FF letest ver. using the same account with 1 email. But the phone is not getting any collar, Bokmr, etc.

    Brother.
    We use win7 with Mozila 31, 4.2 with Mozila Android smart phone latest google app store on 04/10/0214. Using the same account with the same email. But the phone does not get any new information of win7 with Mozila 31. PL z give useful information.

    Hi w3ur_team,
    Thank you for your question. I understand that there are two features that are documented in the sync account. However the Android is not synchronized.

    There are two places we can check:

    1. In the Android settings, under accounts is the Firefox Sync or Firefox Sync (discouraged) joint account?
    2. Credentials work on accounts.firefox.com on the mobile device and are there any error messages in the synchronization of the settings menu > sync?

    See also Firefox Sync troubleshooting and tips for more troubleshooting steps.

Maybe you are looking for

  • Need new cable supply for Tecra M10

    Hello. My Tecra M10 power cable has split (after only 4 years used). Can someone tell me the right product to order? I have more information if necessary. Kind regards Thomas

  • Cannot start hardware

    Hello. Recently I tried to synchronize an e200 V1 to my PC via USB, and as soon as I plugged in the USB, I got a popup window asking to install the equipment. I have completed the installation, but ended up getting a message saying "there was a probl

  • No Audio device detected received after upgrade to Vista message

    NO AUDIO DEVICE NOT DETECTED - UPGRADE WINDOWS XP TO WINDOWS VISTA ULTIMATE Recently, I switched from Windows XP to Windows Vista Ultimate, and now I have no sound. No audio output device detected. I tried the driver far from Device Manager, still no

  • My dv8t will not play blu ray

    Had the dv8t win 7 64 for 2 years. Core i7, 8 GB of ram, he always played the great of the dvd. Put in my first blu - ray disc, and it will not play hp media smart. I get an error of update - Yes or no. No matter what I do, nothing happens. I have do

  • updated drivers for graphics card ati x 1200

    my laptop is an acer aspire 5515 comes with Vista Home Basic. no problems with vista but the problem came when Defender got his monthly update of malware and wanted to remove some of the acers (software) programs... so I bought the full version of wi