2 different counts in a single querry

I'm trying to get a separate account to ID who never had SESC as a means of payment and IDs that moved it. Although they had other methods of payment such as cash or card and then SESC.

Payment as so much money card and the SESC has so below ID 1 (MOVED)
ID 2 has had the SESC SESC so right
ID 3 was money and SESC (MOVED)
4 ID a SESC SESC only if
CREATE TABLE DAN_GR_DELETE
(ID    VARCHAR2(8),
PAYMENT    VARCHAR2(8),
ITEM VARCHAR2(8)) 


INSERT INTO DAN_GR_DELETE (ID,PAYMENT,ITEM) VALUES (1,'CREDIT','CAR');
INSERT INTO DAN_GR_DELETE (ID,PAYMENT,ITEM) VALUES (1,'CASH','BUS');
INSERT INTO DAN_GR_DELETE (ID,PAYMENT,ITEM) VALUES (1,'HECS','BIKE');
INSERT INTO DAN_GR_DELETE (ID,PAYMENT,ITEM) VALUES (2,'HECS','BIKE');
INSERT INTO DAN_GR_DELETE (ID,PAYMENT,ITEM) VALUES (2,'HECS','CAR');
INSERT INTO DAN_GR_DELETE (ID,PAYMENT,ITEM) VALUES (3,'CASH','BUS');
INSERT INTO DAN_GR_DELETE (ID,PAYMENT,ITEM) VALUES (3,'HECS','CAR');
INSERT INTO DAN_GR_DELETE (ID,PAYMENT,ITEM) VALUES (4,'HECS','CAR');
ID     PAYMENT     ITEM
1     CREDIT     CAR
1     CASH      BUS 
1     HECS     BIKE
2     HECS     BIKE
2     HECS     CAR
3     CASH      BUS 
3     HECS     CAR
4     HECS     CAR
WANTED:
MOVED     HECS
2     2
using the:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi

Ok. Can be...

with tt as (SELECT distinct d.id, count(distinct payment) OVER (partition by id) cnt
            FROM DAN_GR_DELETE d)
SELECT (select count(0)
        from tt
        where cnt = 1) HECS,
       (select count(0)
        from tt
        where cnt != 1) MOVED
FROM DUAL
HECS                    MOVED
----------------------- -----------------------
2                       2

Tags: Database

Similar Questions

  • Best way to get different counts on the same column by using a query.

    Hello

    I try to get three different counts of the values for a specific ID on a table.  In other words, I have an Id if 1-123 and 20 records with that ID in this table, which have a value of 'Y' or 'n'.  I'm looking for the number of each of these values for every 20 rows, but also a number of total values of tag values using the function count in a single query.

    In this spirit, I would like to see a result set as follows.

    Example of result set:

    1-123 5 15 20

    I thought that I would be able to do this by using the following query below, but it didn't work and I get a ' error absent expression.  If anyone can provide guidance on my query below or any other way to reach my goal I would really appreciate it.

    Query:

    Select a.par_row_id,

    countOfTagsNo.TagsNo as 'Tags not selected. "

    countofTagsYes.TagsYes as 'Tags selected. "

    countOfTagsTotal.TotalTags as 'Total Tags'

    of siebel.s_src_xm.

    (select par_row_id, count (attrib_08)

    of siebel.s_src_xm

    where type = 'AOI Tags' and attrib_08 = 'n')

    countOfTagsNo,

    (select par_row_id, count (attrib_08)

    of siebel.s_src_xm

    When type = "AOI Tags' and attrib_08 = 'Y')

    countofTagsYes,

    (select par_row_id, count (attrib_08)

    of siebel.s_src_xm

    When type = 'AOI Tags' and (attrib_08 = 'Y' or attrib_08 = 'n'))

    countOfTagsTotal

    where a.par_row_id = countOfTagsNo.par_row_id and

    a.par_row_id = countofTagsYes.par_row_id and

    a.par_row_id = countOfTagsTotal.par_row_id

    A.par_row_id group;

    Thanks in advance.

    Chris

    Hi Chris,

    I'm not sure that's what you want but you had probably better counting with nested decode (or case):

    Select a.par_row_id,

    Count (case when type = 'AOI Tags' and attrib_08 = ' don't then 1 end) as "Tags not selected."

    Count (case when type = 'AOI Tags' and attrib_08 = 'Y' then 1 end) as "Tags selected."

    Count (case when type = 'AOI Tags' and (attrib_08 = 'Y' or attrib_08 = 'n') then 1 end) as 'Total Tags.

    of siebel.s_src_xm

    A.par_row_id group;

  • How to apply different Skins in a single list

    How to apply different Skins in a single list

    See post on:

    http://supportforums.BlackBerry.com/T5/Tablet-OS-SDK-for-Adobe-Air/customized-list/TD-p/648335/page/...

  • I use Windows 7 and I am not able to print several different images on a single page.

    When I try to print photos from the 'My pictures' library, I use the following steps:

    1. turn the photo highlight

    2. click on 'print '.

    3. in the window that says: "How do you want to print your photos? I choose the number of photos I want per page, for example 3 x 5.

    4. when I try to add a picture DIFFERENT from my library so that I can print several different photos on this page of photos of 3 x 5, it simply replaces the previous photo. How can I get there?

    Thank you.

    Original title: I use Windows 7 and I am not able to print several different images on a single page. The answer posted here from 8/11 includes a link that does not work.

    Hello

    Welcome to the community of Microsoft and thanks for posting the question. I've surely you will help find a solution on the issue.

    What program you want to use?

    We will try to print in a different way and check.
     
    Open Paint and then do a collage of different photos then save it then open it in their program and print.
     

    To print the image in Microsoft Paint, steps to follow:

    a. Click Start, in the search box, type in the paint.

    b. open the document you want to print.

    c. select print and check.

     

    With the help of paint

    http://Windows.Microsoft.com/en-us/Windows7/using-paint

     
    Hope this information helps. Please reply back with the
  • How to choose different lines for a single sale order and ship individually

    I have a customer order of lets say 10 broadside of this same article for quantities of 10 each which means 100 quantities.

    When I use the release sales order form it will take the entire order and forward it.

    But I need to take the line and then generate a delivery against it and then to ship and invoice it.

    Need to know how to do this

    You can take different lines for a single sales order and ship individually using FORM of TRANSACTION of DELIVERIES.

    Navigation: OM RESP > order management > shipping > Transactions

  • Can FrameMaker to create several Master Pages with sizes different pages in a single file of FM?

    Can FrameMaker to create several Master Pages with sizes different pages in a single file of FM?

    N °

    You must break your content between files and use the book feature to apply numbering to make look it seamless. Sometimes, if you can, re - organize the content so that all oversize pages come at the end of a chapter/file makes it easier to manage a such split files in the book.

  • Wanted to buy three licenses of creative cloud for three different users with a single credit card. [was: HELP!]

    Hi, I wanted to buy three licenses of creative cloud for three different users with a single credit card. I am connected to my computer three times and the buyer licenses three. Now, I found that all licenses are associated with MY ACCOUNT! Is this normal?

    Orders are not yet completely resolved, and once this is done, you can directly contact billing support team.

    To the link below, click on the still need help? option in the blue box below and choose the option to chat or by phone...

    Make sure that you are logged on the Adobe site, having cookies enabled, clearing your cookie cache.  If he continues to not try to use a different browser.

    https://helpx.Adobe.com/contact.html?step=ZNA_account-payment-orders_stillNeedHelp

    Concerning

    Rajsahree

  • Get the Max values and average of the different cycles in the single channel

    Hello

    I'm trying to get the Max values and average of the single channel that has different cycles it contains. I tried to use commands such as Chnclasspeak3 and chnpeakfind, but they were not useful for me. What I need is the Max values and average of the different cycles numbers saved in the data channel.

    Exampld if the string contains 5 numbers of repetitive cycles, then we must find the maximum values and the average of these 5 cycles in the single channel. Attached reference data. This is the .raw file and I have the plugin for it to use in diadem 11.1.

    Kind regards

    X. Ignatius

    Hello, Ignatius,.

    Sorry, it took some time to provide a replacement based on the script for the function. Please take a look at the attached script. I changed the script to use my function if the tiara-version is less than 12. My script function is not as fast and more stable than the implementation of tiara, but for now, it does the job

    Andreas

  • Print texts in different formats on a single page

    Hi all

    Is it possible to print on one page text in different fonts and sizes? It seems that PrintTextBuffer prints all text on a single page at a time and there is no chance to change the format. Thank you

    LT

    I must confess that I give you this suggestion, but I did not use these functions for several years ; test your function on my system now (CVI 2009SP1 on Win7 with HP LaserJet printer) I have the same results as you.

    Due to the limitations of this method of printing, I moved quickly to the other printing modes: there are many discussions you will find in the forums on the reports, but basically, you can:

    • Create a hidden Panel 'report' where to print your data on the standard controls (strings, numbers, graphs, tables and so on) and use PrintPanel to print it
    • Use NIReports instrument
    • Use Office report print (via Word or Excel)
    • Create a PDF file
    • ... (other methods that I can't think of right now)

    One is probably the fastest: you already used to create panels and after a short trial, you can set the correct control/panel aspect for a good report. It also allows you a limited preview if you want to.

  • Passage of a setting for two different queries on a single page

    I followed tutorial ADF - value of the parameter passing between Pages. It works very well, but I tried to add a second query to the page single.jspx , using the same setting and it shows all the data.

    I tried to analyze the queries and the problem is in bind variables. While the first query gets the right value, the second Gets null (see the log below). I also noticed that if I return to the single.jspx page, only the first request is executed.

    < oracle.adf.model > < ViewObjectImpl > < buildQuery > < [3556] SELECT ServiceRequests.ASSIGNED_DATE,.

    ServiceRequests.ASSIGNED_TO,

    ServiceRequests.CREATED_BY,

    ServiceRequests.PROBLEM_DESCRIPTION,

    ServiceRequests.PROD_ID,

    ServiceRequests.REQUEST_DATE,

    ServiceRequests.STATUS,

    ServiceRequests.SVR_ID

    OF SERVICE_REQUESTS ServiceRequests

    WHERE (ServiceRequests.SVR_ID =: p_svr_id) >

    < oracle.adf.model > < ViewObjectImpl > < getPreparedStatement > < ViewObject [3557]: [oracle.srdemo.model.ServiceRequestById_VO] AppModule.ServiceRequestById_VO1 created new QUERY statement >

    < oracle.adf.model > < ViewObjectImpl > < bindParametersForCollection > < [3558] params for ViewObject Bind: [oracle.srdemo.model.ServiceRequestById_VO] AppModule.ServiceRequestById_VO1 >

    < oracle.adf.model > < OracleSQLBuilderImpl > < bindParamValue > < [3559] param 'p_svr_id' liaison: 111>

    < oracle.adf.model > < ViewObjectImpl > < buildQuery > < [3716] select svh_date, service_histories where svr_id =: p_svr_id order of svh_date >

    < oracle.adf.model > < ViewObjectImpl > < getQueryHitCount > < [3717] number of rows estimated for ViewObject: [oracle.srdemo.model.ServiceHistoryByRequestId_VO] AppModule.ServiceHistoryByRequestId_VO1, query statement: >

    < oracle.adf.model > < ViewObjectImpl > < getQueryHitCount > < [3718] ' SELECT count (1) FROM (select svh_date, notes from service_histories where svr_id =: p_svr_id order of svh_date) ">"

    < oracle.adf.model > < ViewObjectImpl > < getQueryHitCount > < [3719] Bind params for ViewObject.getQueryHitCount: ServiceHistoryByRequestId_VO1 >

    < oracle.adf.model > < ViewRowSetImpl > < doSetWhereClauseParam > < [3720] ServiceHistoryByRequestId_VO1 ViewRowSetImpl.doSetWhereClause(-1, p_svr_id, null) >

    < oracle.adf.model > < OracleSQLBuilderImpl > < bindParamValue > < [3721] null of type 12 for connection "p_svr_id" > ""

    I got it.

    I need to add an another ExecuteWithParams of the request on the other in the pageflow.

  • Styles of different notes in a single document - another approach

    Hello

    I'm working on a book that contains two types of notes:

    • original notes of the author of a book - up to three on a spread, numbering restarts at each broadcast
    • notes from the editor of the current edition - compatible numbering throughout history

    I've prepared two different paragraph styles for them. The two types of notes may appear on a single page (some of them are even nested - comments from the editor of notes of the author, but we'll leave it for now).

    I am aware that InDesign supports not multiple reference styles. I searched for the possible workaround on this forum and on the web, but could ' t find a satisfactory solution. Then I tryied on my own - my attempts are described below. It would be great if someone could suggest a better solution or fix my approach:

    A. use standard notes feature for first style and anchored objects for the second:

      1. Create anchored some notes text blocks
      2. Apply an object style that moves to the bottom of the main text block
      3. Apply the paragraph with numbering style
      4. Creating a cross-reference (working as a reference number in the text) pointing to the paragraph number

    That works very well with one exception - if there is more than one false note on a page (and oh yes, there are), they simply overlap rather than be stacked at the bottom of the main text block. I was hoping to solve that by using the wrap text property, however it has turned out that wrapping does not work between two anchored objects. Their adjustment position manually would be a pain in the case of any change.

    B. let all notes as notes, but hiding their numbers

      1. Leaving the two types of notes as standard InDesign notes (so that they are correctly placed at the bottom of the text)
      2. Hide a number of reference in the text and a reference number using character style
      3. Styles of different paragraphs of Appling two to the text of the notes, with two different styles of numbering
      4. Creating a cross-reference as A solution and placing it after the hidden reference number

    This one seemed smart enough, until I discovered this numbering does not work in the set of notes (each note is numbered '1'). InDesign seems to treat as separate stories, regardless of what the parameters of numbering of lists. AAARGH.

    C. let all notes as notes, hiding their numbers, creating objects of the lively with reference numbers

      1. Leaving the two types of notes notes standard - like solution B
      2. Hide a number of reference in the text and a reference number - like solution B
      3. Appling different paragraph styles both in the text of the notes, but without no numbering
      4. Inserting a block of text anchored after each number reference (hidden) in the text
      5. Applying numbering to anchored text frames (using the paragraph style)
      6. Insertion of a reference at the beginning of each reference text, pointing to the numbering of the corresponding anchor text block

    This can actually work, but for me it is neither elegant nor reliable. For now I am stuck looking for a way to insert cross-references in the text of the notes automatically (there are about 250 notes, then that would be useful).

    So that is where I am right now. All advice?

    Thanks for reading all this

    Waldek

    IMHO, the cooler is to make invisible the base (appeal and references) numbering notes replacing the note calls by a block of text, anchored with automatic numbering [2 = object styles styles para 2 + 2 lists numbering] and references the references on those paragraph styles 2 remark.

    If you need a numbering on doc, easier, but if for example per page, just restart the 2 numbers per page for each page!

    As the only 250 notes, do this manually! Not really need a script! It's very fast! (~ 1 hour to do!)

    Of course, when it's done, let's do it!

    On all the doc:

    Per page:

  • Avoid to group all the objects in different layers into a single layer

    When I group objects to different layers, they all end up in single layer... I have a slight memory of what it is possible to the group object without affecting the layers... maybe a setting?

    Vincent,

    Crossposting: I was the addition of the procedure (which I posted accidentally before finishing).

    Here's the Bill:

    But you can create a selection across layers as follows, using the drop down selection:

    Select objects, then > Save selection, selection of a name;

    After that, the choice is displayed at the bottom of the drop-down list selection, available for selection (sorry)

  • Is it possible to merge images of 4 different files into a single image of 4 x 4 with ps scripting?

    I have therefore four files that each contain 970 images.   The pictures in the folder 1 are exactly the same as the images in the folder 2, 3 and 4.   All images are also in size 400px.   What I'm trying to do is to take images of the same name of each of the 4 files and put them into a single image of 800 x 800, then they are arranged in a 4 x 4 mode.

    Example: Each folder has an image named mastiff1.psd.  Images of four mastiff are different, but have the same name and have the same size.  I wish that all the images of four mastiff to be combined into a single image to double size who has all four images mastiff on it and save it as mastiff1 - 4 x 4.

    Is that something this photoshop script could do?  I'm a newb to this.  I used actions much, but never a script.

    For the script, you need to know a programming language JavaScript script that works on both platforms of Photoshop or AppleScript which will be only the Apple Mac machines, VSbasic or that will run only on windows.  You should also know how Photoshop and know how to use Photoshop well.

    There are some things that cannot be scripted to DOM Adobe doesn't have the methods of the interfaces for all of the functionality of Photoshop.  However, there is a plug-in with Adobe name Scriptlistener witch is as a recorder of script that you do in Photoshop that can be recorded in actions is recorded in two papers on the desktop you when the Scriptlistener plugin is installed is in the JavaScript syntax in VSbasic.   As Actions there is no logic just hard coded step, step, step...  The code uses the Operations Manager to do the function of Photoshop.  If the things that cannot be scripted using Adobe DOM can be scripted by using the action handler code produced by the Scriptlistener plug-in and hard-coded steps can be changes in javascript functions that use variables.

    According to me, what do you think would be a real ambitious first Photoshop script.  Adobe script documentation, the example script and Scriptlistener are not part of the standard installation. You need to download these from Adobe. Adobe Photoshop scripts. Adobe Developer Connection.

    I don't really know javascript, but I can hack it. Did some scripts in the document layout.  Most require a PSD template but PasteImageRoll does not work, but any Image must be in the same folder.  Most of my automated script require any image to be in the same folder.  However, two of my scripts are interactive.  You can select each image available from anywhere.  Images will be automatically resized and positioned to which you can then edit.

    I'm not the best eaten encoder, you can always look at the code I came with.

    Script to roll stick Image and picture package Support

    Image Collage Kit getting up-to-date made turn to Best Fit an option in PasteImageRoll.jsx change to customize your default settings.

    Scripts for Photoshop is powerful and I think that this package demonstrates this.

    The package includes four simple rules to follow to make Photo Collage Template PSD files so they will be compatible with my Photoshop scripts.

    There are twelve scripts in this package, they provide the following functions:

    1. TestCollageTemplate.jsx - used to test a model of Collage of Photo while you're doing it with Photoshop.
    2. CollageTemplateBuilder.jsx - can build models that are compatible with this toolkit scripts.
    3. LayerToAlphaChan.jsx - used to convert a stack of the Prototype Image layers in a document template.
    4. InteractivePopulateCollage.jsx - used to fill interactively model Any Photo Collage. Offers more user control insert images and text.
    5. ReplaceCollageImage.jsx - allows to replace an object layer dynamic image collage populated with another image resized and positioned correctly.
    6. ChangeTextSize.jsx - this script can be used to change the size of text Image stamps when the size used by the filling did not work well.
    7. PopulateCollageTemplate.jsx - used to fill a Photo Collage template and leave the populated copy automatically opened in Photoshop.
    8. BatchOneImageCollage.jsx - used for the models automatically batch fill Collage that have only a single image inserted. The Collage or picture may be stamped with the text.
    9. BatchMultiImageCollage.jsx - used to model automatically batch fill any Photo Collage with images in an image source folder. Easier to use than the interactive script. Recorded collages can be twisted.
    10. BatchPicturePackage.jsx - used to model automatically batch fill any Photo Collage with an image in the image source folder
    11. PasteImageRoll.jsx - paste Images into a document to print on roll paper.
    12. PCTpreferences.jsx - edit this file to customize Collage fill preset scripts and add your own layer styles.

    Documentation and examples

  • Capture the salary of the employee in different currencies in a single enterprise group

    Hello

    Scenario: According to group unique buiness, information of the employees of several countries are counted (as there may be very few employees in each of these countries).

    Status of pay is NOT implemented, how we capture information on country-specific employee wages to say, capture of an employee's salary in different currencies under unique business group.

    Thank you

    You can use Add'l salary admin. Details FDF to capture the currency and converted value. Salary of the hand will be in a base currency.

    Thank you

  • How can I create several different signatures to a single account or address?

    I want to create signatures 2 or more different for the same accuont, for the same mailbox. How can I do this?

    Take a look at this module.
    https://addons.Mozilla.org/en-us/Thunderbird/addon/signature-switch/

Maybe you are looking for

  • CAPTURE VIDEO AND AUDIO FROM THE DESKTOP

    I USE A PAVILION DV 7-6163 WINDOWS 7 OS. WHEN I CAPTURE VIDEO FROM MY OFFICE, I ALSO CAPTURE ANY SOUND MY MICROPHONE PICKS UP. A COUGH OR SNEEZ. HOW TO PREVENT THIS? Thank you

  • Very slow WiFi on the 3G xoom with update 3.2

    Hi all Was wondering if anyone else has the same problem. I bought the unit a few days before and same day updated to Android 3.2 version. I use internet on my Wifi at home and have a Netgear - WGR614 router. Browsing speed is very very slow and do n

  • Win7 update error code 643 KB 973688

    Error code Win 7 643 for update for Microsoft XML Core Services 4.0 Service Pack 2 for x 64 systems (KB973688). Must have tried 10 times at least. All I get is the error code and it can not install XML based Services. Have you tried system restore, b

  • Cannot print: Error Message on F4480-(OS 10.6.8) library/printers/HP

    Pilot plant, put in the new ink.  Unplugged, turned off the computer and the printer, restarted... always get the message: "" Error: / Library/Printers/hp ". Went into settings, printer / fax & checked - printer is listed as default value.  Went to u

  • Wireless identification information requested by vista

    Hello I have two new laptops, one for me and runs on the new windows 7.  I created a new wireless network, but now I am unable to get the other laptop that is running vista connected to the wireless network. Vista asks USER NAME, PASSWORD, AND logon