How to create a group of partially with equal fields?

I'm doing a group by the following query to the companies of the group with cnpj different although they are of the same matrix (the condition for this is that the first of the cnpj 08 numbers are equal and that the other may be different). Could you help me?

Select n.cli_nom, c.cnh_clifat, sum (c.cnh_valcnh) of cnhcad c

clicad n on n.cli_cod = c.cnh_clifat inner join

where c.cnh_datcnh between 1 January 2014 "and August 15, 2014"

and c.cnh_numcnh > 0

and c.cnh_sercnh <>"Mi".

and c.cnh_ctesta = 100

and c.cnh_clifat like 3420926% '-this would be the condition for group records

N.cli_nom group, c.cnh_clifat

sum (c.cnh_valcnh) desc order


with my_data as (
select 'company_1' company, '555874' as code, 1000.00 as billing from dual union all
select 'company_2' company, '333659' as code, 500.00 as billing from dual union all
select 'company_3' company, '555878' as code, 3000.00 as billing from dual union all
select 'company_4' company, '333661' as code, 9000.00 as billing from dual
),
transformed as (
select md.*, substr(code,1,3) code_prefix
from my_data md
)
select distinct t.code_prefix, sum(billing) over
                (partition by t.code_prefix order by t.code_prefix) billing_sum
from transformed t
order by t.code_prefix
CODE_PREFIX BILLING_SUM
----------- -----------
333                9500
555                4000

Tags: Database

Similar Questions

  • How to create a file name variable with the County and the date?

    Objective: Create a file name variable with the County and the date

    Error: get a lot of error. Do you know how to change my code?

    Question: how to create a file name variable with the County and the date?

    Mini code:

    std::string * rawfilepath;
    std::string * rawfilename;

    rawfilepath = "./shared/documents/";
    RawFileName = rawfilepath + 'rawlog -' + 0 + '-.txt ';
    QFile file (rawfilename);
    If (file.exists ()) {}
    rawfilenamecount ++;
    RawFileName = "./shared/documents/rawlog-" + rawfilenamecount + "-.txt ';
    }

    Thank you for your attention,

    Thank tzander reminding me the idea. Method of cascades is not good for me because all of the kernel code is written by Native. If I change the channel to QString, I need to change a lot of codes.

    Solution is below.

    While (access (rawfilename, F_OK)! = - 1) {}
    rawfilenamecount ++;
    sprintf (format, RawFileName, rawfilenamecount);
    fprintf (stderr, "file exists");
    }

    Rawlog = fopen (rawfilename, "w"); Save the file in a specific path.
    fprintf (rawlog, "System Time (ms)" "");

  • How to create a user local administrator with the user root on the CV

    As says the tile, how to create a user local administrator with the user root on VCS-Express. I lost the password and cannot log in as an admin user, but I can't seem to log as long as user root.

    Once connect you with the root account, type in "tsh", from there, you can create the accounts of local administrators with 'xCommand AdminAccountAdd.  See the reference section of command of the VCS Administrator's Guide, starting on pg 517.

    If your VCS is a virtual machine, you can change the password of admin with vSphere, or if it is a hardware appliance, you can use the serial port, see pg 312 of the Administrator's guide.

  • How to create a my Signature (signature with the tablet of manufacturing) Action?

    How to create a my Signature (signature with the tablet of manufacturing) Action?

    I use PSCS6?

    I have no problem making an action of signature if I pick a font and then type in my name,

    but to make a real action of my signature seems impossible.

    Hello

    There is a very cool technique to do by your signature in a Photoshop brush.  Once this is a brush, you can change the size and place the signature everywhere where you want.

    Google "Photoshop brush signature" or something similar and you will see a lot of tutorials.  Try this one:

    Photoshop reference guide | Creating a custom brush Signature | Peachpit

    Basically, you sign your signature on a blank piece of paper, then you scan in a JPG or TIFF file, then you open that file in PS to create a brush.

    I hope this helps.

    John

  • How to create a form of relief with highlight on the edge, in 2015 of the Illustrator

    I work in 2015 of the Illustrator. How to create a shape (3d) raised with highlighted on the edge, like this:

    Coordinate shape.jpg

    It will work as a form, not a button, so there is no need of different States. I looked at a few tutorials to create buttons, and they seemed much more complicated that I think you need to create a form like this.

    -Stuart

    Experience 3D bevel & emboss, front view and Tall-round bevel. Adjust the lighting you want. Then add a light shade.

    Personally I have always found these bevel unsatisfactory effects, but you can produce similar results using carefully controlled mixtures

  • How to create the object rectangular box with a pure action script.

    How to create the object rectangular box with a pure action script?

    I think, it can be done through the clip library, but I'm not sure. Please, I want to take the suggestion to create a rectangular box as a script through

    Take a new file and write about the first image the code below, it works fine:

    var rect = new Shape();
    rect.graphics.beginFill (0xFF0000);
    rect.graphics.drawRect (0, 0, 100,50);
    rect.graphics.endFill ();

    var MC = new MovieClip();
    mc.addChild (rect);
    addChild (mc);

    If this doesn't solve your problem then paste the error you get

  • How to create a group using photoshop scripts?

    Hey guys,.

    I can create a layer easily with the following code.

    But how do I create a group that contains more than one layer.

    docRef var = app.documents.add ();

    myLayer var = docRef.artLayers.add ();


    Here is an example...

    var doc = app.documents.add();
    var newLayerSet = doc.layerSets.add();
    var myLayer = doc.artLayers.add();
    var myLayer2 = doc.artLayers.add();
    //move the layers into the layerset
    myLayer.move(newLayerSet, ElementPlacement.INSIDE);
    myLayer2.move(newLayerSet, ElementPlacement.INSIDE);
    
  • How to create a new auto sync with Salesforce?

    We try to create a new automatic synchronization so that we can test with a second profile of Salesforce integration, but I don't see anything on the screen Auto Synchs which shows how to create a new.

    Anyone has any ideas on where to start?

    Installation--> integration--> inbound--> create Data Sources

    Create a new external call and make sure that CheckBox 'calendar for automatic execution' this will allow this call for automatic synchronization. I will link an article shortly...

    Edit: Surprisingly, I can't find an article dedicated to the implementation of an automatic synchronization, but you can renovate sort of article to meet your needs for a walk through...

    Navy Playbook: Change Email in CRM

  • How to create a table of contents with contextual submenu?

    Is it possible to create a submenu using the standard function of the table of contents? We need a pop-up submenu it...

    That would be my suggestion: using variables, shared (or advanced, but here, you can certainly shared use) efforts to create such a menu. You can put it on the first slide, scheduled for the rest of the project. Then use a button to toggle to show/hide this menu.

    No integrated solution, although what I have explained any grouping of slides, with groups of expand/retract can be a more limited version if you use the table of contents available.

  • How to create forms in pdf format with text for example which can be rewritten

    I'm using a mac (version 10.10.2), using acrobat pro. Originally created the document in InDesign, then create form fields in acrobat pro.

    Sorry for the somewhat confusing title. Basically I have a pdf I want to be able to change.

    I've set up the PDF with form fields that works perfectly - however, I would like to have a sample text in the areas that can be "crushed" by a new text.

    Example of

    If the field were asked for the date, it would be in gray italics an example of date, (ie. 01.01.2016)

    Then when you clicked on the ground this example text would disappear and then when you typed in the new data, it would appear in normal black text.

    I can't understand how to do this on a form which is not online, as this form will be sent from one person to another and not hosted on a site.

    Help would be apprectated!

    Yes, the default value is under Options.

    Two scripts have to go under Actions, Yes. You select the trigger first (on the focus and then on Blur) and the type of action is "Run a JavaScript" then when you add it to the list of Actions, a window will open. Paste in the code and press OK. That's all...

  • How to create a new virtual machine with two warehouses of data through new-vm?

    Hi guys,.

    Can you please help or direct me to the right format? I'm new with vsphere powercli.

    How to create a virtual machine with two other data store by using the new-vm?

    $datastore1 = get-datastore. WHERE-object {$_.} Name - eq "lun1"}

    $datastore2 = get-datastore. WHERE-object {$_.} Name - eq "lun2"}

    new-vm-name vmtest01 - VMHost ESXserver - datastore $datastore1 diskmb - 8192 $datastore2 diskmb - 8192 - memorymb 4096 - numcpu 2 - ID winNetStandardGuest

    I got this error when I run vsphere powercli. I appreciate if you can help. Thank you

    New-VM: cannot bind parameter 'DiskMB '. Cannot convert the 'lun2"val

    EU to type 'VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.DatastoreIm '.

    PL"type"System.Int64 ".

    At line: 1 char: 85

    + new-vm-name vmtest01 - VMHost ESXserver - $datastore1 data store

    diskmb - < < < < 8192, $datastore2 - diskmb 8192

    + CategoryInfo: InvalidArgument: ( , ParameterBindingE)

    Xception

    + FullyQualifiedErrorId: CannotConvertArgumentNoMessage, VMware.VimAutomat

    ion.ViCore.Cmdlets.Commands.NewVM

    Bryan

    The New-VM cmdlet takes a single value of the parameter - data store and all of the virtual disks will be located on this data store.

    If I understand your request, you create a virtual machine with 2 virtual disks, each on a different data store.

    You can use the cmdlet New - hard drive for it.

    $datastore1 = get-datastore | where-object {$_.Name -eq "lun1"}
    $datastore2 = get-datastore | where-object {$_.Name -eq "lun2"}
    
    $vm = new-vm -name vmtest01 -VMHost ESXserver -datastore $datastore1 -diskmb 8192 -memorymb 4096 -numcpu 2 -GuestId winNetStandardGuest
    new-harddisk -vm $vm -datastore $datastore2 CapacityKB (8192 * 1KB)
    

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • How to create criteria to display named with the EXISTS operator?

    I use JDeveloper 11.1.1.2.0. In Guide of Fusion Developer's for Oracle Application Development Framework in the section "How to Create Named views criteria declarative 5.11.1" I found figure '5-41 Edit View dialog with a view specific criteria criteria", which used the EXISTS operator. But I can't repeat this example in my project, coz I can't find operator EXISTS in the list of choices. ?:|

    link to the image: [http://img23.imageshack.us/img23/1708/jdevexists.jpg]

    Vitaly,

    I checked this in 11.1.1.3, YMMV Yes.

    The operand EXISTS is fine for me. According to the document that you referenced (at least in 11.1.1.3 docs), you can use the operand EXISTS when the "attribute", you select another VO referenced via a link display:

    The list shows only the operators that are appropriate for the selected
    object attribute or view. In the case of a selection of objects in view, it is
    operator applies a standard of display you set (or reference) as a
    operand

    John

  • I can't find how to create a group list rom installed contacts window Live Mail contact.

    Recently installed Live mail and as far as I can see there is no place to create a group list to send more than one person at5 e-mail once.  I couldn't transfer my list of Outlook 2002 Group to live mail;

    Given that you wrote "recently installed Live mail...". ", I assume you meant Windows Live Mail 2011 .

    If not, please ignore the following.

    If Yes...
    Open WLM 2011 > at the bottom left, click the icon that represents Contacts

    at the top, click on category (category = group) > enter the name of the Group > select contacts who will be in the Group > click Save when done.

  • How to create a group in the list of contacts in BB

    Hello..

    I need to create a group in the list of contacts in bb...

    help me by providing code samples...

    Thanks in advance...

    ~ Sam

    It is not possible to create the BlackBerry groups programmatically in the Contacts application.  Only read access is provided.

  • How to create a static PDF form with fields that can be filled by a process automated.

    Where are the instructions for creating a PDF form, with open fields and then store them on my server.  Then an automated process will access the form and fill in the fields of the form so that the user of the system can print it. Where are the steps recorded?

    Hello

    See the following document.

    Acrobat Pro DC of accessible forms and interactive Documents

    Concerning

    Sukrit diallo

Maybe you are looking for

  • Unable to connect to home WiFi

    Hello. Using a 2012 MacBook Pro runs El Capitan 10.11.4 and unable to connect to Wi Fi home exclusively. We had to Time Warner to get out. They gave us a new modem/router and update the connections/splitter in the basement. All our devices but my lap

  • Looking for a SSH Client for Firefox OS

    I am looking for a SSH Client for Firefox OS (1,3). A FireSSH add-on is available for a 'normal' version of the firefox browser, but unfortunately it can not be installed in the mobile version. Greetings Michael

  • My MacBook Pro doesn't dΘmarre

    Hello My MacBook Pro was on the way "sleep" for a week. I opened the cover to awake, but did not work, then it plugged into the power supply and switched on, but just hearing the sound of the chimes and nothing happene, the screen was completely blac

  • HP Recovery, causing hard drive problem

    OK... Earlier I messed up my hard drive on my laptop. So I got the HP recovery discs, used... I thought that it fixed the problem... but now I look in the properties of my C: / drive & it says that my hard drive is only 25GB. Which is weird, because

  • Windows Mail toolbar is empty.

    I use Windows Mail on a Vista Home Premium SP2 computer. Recently, the toolbar has started going empty - the toolbar is there, but there is nothing on it, and clicking on this product no reaction. Windows Mail sometimes opens in this way. Sometimes i