Query on Count on 2 descriptions  with group by on both the desccriptions

Table I - Details
partyid,
cgl_prodid,
mis_prodid,
cgl_desc,
mis_desc,
Table 2
partyid,
custrelbucket,
countrycd.
i am relating these 2 tables thro partyid.
I need a summary information of how many party id's have distinct count of Misproduct and distinct count of cglproduct with their descriptions.
the total of Misproducts ,cglproducts should be displayed ina report as summary information .
Report Spec
PartyIdCount     Misproduct Count     Mis Desc     Cgl Count     Cgl Desc      Country cd      Cust relbucket
23     56     Blick -I      23     Contra Acc     4     10
56     23     Blick -I I     24     Consumer Loans     4     10
If you have problems understanding my problem. pleas mail me on [email protected]
Message was edited by:
user461501

If you had posted the CREATE,INSERT scripts of both tables and a clear picture of the tables data and it's expected output, you would have got a better response.
This forum is based on Volunteers who offer thier help for FREE. The more clear you question is, more response you will get.

Similar Messages

  • Why can't I sync my phone with my computer after both the ios7 and Itunes 11.1 updates?

    I just recently purchased the new iPhone 5s and have been very happy with it.  At the same time I updated my itunes to the newest version 11.1.0.126.
    Since the initial syncing, I have been unable to complete the syncing process.  It progresses all the way through stalls out on step 5 "Downloading Safe Safari Browising Data".  Is there anything i can do to fix this issue?

    Which is precisely why I am frustrated with how proprietary Apple is.  No matter how much people try to spout out about the superiority of Apple products, my iPhone should be able to grab music from my laptop and my PC at home, both being authorized already.  I've already tried home sharing.  I didn't buy the iPhone outright, it was provided to me through work.  For all the Apple and Mac only fans, I feel this is Apple's way of trying to make me purchase music I have already bought on CD through iTunes.  Whatever happened to ease of use?  Customer friendly applications?  Anyone else dislike how hard it is to add artwork to an album in iTunes after you load a CD and it doesn't recognize it?  Track by track?  How about offering one simple, convenient copy and paste to album like in Windows?  Oh, yeah, so you give up and buy it again in iTunes.  I do like the interface on the iPhone or iPod once things are working properly, however the hoops you jump through are ridiculous.  I want to load music off of my laptop, after having most of my library on another PC, and it won't work without deleting the library off of the phone.  What is the point of authorizing up to 5 computers if you can't use your music from those different machines?  There, I'm getting off of my soap box now.

  • How can i get a query to count a number of strings?

    I want the query to count for me how many holidays there are to the USA in my table. But im not sure how to get it to retreive the result of a string or varchar2 datatype. This is what i have tried so far.
    select count(COUNTRYVIS) <<this column contains all the countries visited
    from "IT220_HOLIDAYDETAILS" <<this is the table where the column is
    where COUNTRYVIS = "USA" << this is the result i want it to count
    ORA-00904: "USA": invalid identifier <<this is the error message im getting, is there a way to count strings?
    Thanks in advance!

    This has nothing to do with APEX. Please post basic SQL questions on the +{forum:id=75}+ forum.
    In any OTN forum, alll code should be posted wrapped in <tt>\...\</tt> tags as described in the FAQ:
    select count(COUNTRYVIS) -- this column contains all the countries visited
    from "IT220_HOLIDAYDETAILS" -- this is the table where the column is
    where COUNTRYVIS = "USA" -- this is the result i want it to countYou appear to be struggling with the distinction between identifiers and text literals. Hint: One uses double quotes, the other single quotes.
    Note that quoted identifiers are generally not a good idea.

  • Currency conversion with Group consolidation does not work

    Currency Conversion WITHOUT group consolidation works (script logic reads CURRENCY = %GROUPS_SET%) which puts out values in USD. The values were translated correctly as per the exchange rates.
    Now, since we need consolidation, I ran currency consolidation WITH group consolidation (I changed the script logic to read GROUP = %GROUPS_SET%). FXtrans package runs successfully with 0 records (0 submitted, 0 success, 0 fail).
    I also referred NOTE 1519146.
    Please advice.
    Thanks,
    Tagz

    Hi,
    You can try to use %GROUPS_DIM% or the dimension name directly in the dynamic script as suggested.
    And also try after modifying your currency conversion script as GROUPS = %GROUPS_SET%. If this does not work please try
    by hardcoding GROUPS=Value in the script and let us know how it works.
    Hope this helps.
    Regards,
    Shoba

  • You cannot create a customer with grouping ZLES

    hi friends,
    I am encountered with the below message during BP creation "You cannot create a customer with grouping ZLES"
    ZLES being the account group..
    I ve come across the following..
    I made config for BP to Customer ( auto creation)
    and also BP to Vendor ( auto creation)
    at a time only one of the thing is working either BP to customer or BP to vendor..
    when i check the config  under Number Range>Define Groupings and Assign Number ranges> in this there is a radio button Int.Std.Grping if this is marked for the grouping of Mast tenant with Cust acc  then there is no error for this but error persists while creating BP to Vendor.. and if the radio button is ticked for Landlord with vendor Account then the issue comes for BP to Customer i.e the error "You cannot create a customer with grouping ZLES"
    how can i tick both of them together ( if there is possiblity)
    kindly help

    sorry for late reply.
    if ur issue isn;t solved?----
    in  Define Groupings and Assign Number Ranges dont select the raido button for your grouping . and next thing is while creating business partner. follow these steps...
    1 bp
    2 click on person, group or org as desired
    3 select the role and click create. AND
    4 at right hand side corner there is Grouping select the Grouping ( i was missing this step due to which i used to get the error)
    hope this will solve ... also check the account groups of both BP and Customer or else there will be synchronisation error..
    regards

  • Syncing contacts with groups from Torch to Mac

    We have a BlackBery Torch, the latest operating system for Apple (OSX Lion), the latest update of BlackBerry Desktop software and the latest update on the Torch.
    When we perform a sync from the Torch, it syncs all contacts but without the groups. How do you sync contacts with groups? To clarify, the contacts are in groups on the BlackBerry. 
    Thanks!

    Anyone ever experience syncing contacts with groups on a Mac?

  • How to write a query with group by and order by for a date column

    I have a query:
    select count(*), to_char(s.pdate,'Mon-yyyy') as month from sTable s
    group by to_char(s.pdate,'Mon-yyyy')
    order by to_date(s.pdate,'Mon-yyyy')
    However, I got an error: not a GROUP By expression.
    If i just run: select count(*), to_char(s.pdate,'Mon-yyyy') as month from sTable s
    group by to_char(s.pdate,'Mon-yyyy')
    it is work fine.
    How to solve the problem.
    Thanks,
    Jen

    Jen,
    You can use this code
    with sTable as (select to_date('01/01/2009', 'dd/mm/yyyy') pdate,  1 code from dual union all
                  select to_date('02/02/2009', 'dd/mm/yyyy') a, 2 code from dual union all
                  select to_date('01/03/2009', 'dd/mm/yyyy') d, 3 code from dual union all
                  select to_date('05/04/2009', 'dd/mm/yyyy') g, 4 code from dual union all
                  select to_date('05/05/2009', 'dd/mm/yyyy') g, 4 code from dual union all
                  select to_date('05/06/2009', 'dd/mm/yyyy') g, 4 code from dual union all
                  select to_date('05/07/2009', 'dd/mm/yyyy') g, 4 code from dual union all
                  select to_date('05/08/2009', 'dd/mm/yyyy') g, 4 code from dual union all
                  select to_date('05/09/2009', 'dd/mm/yyyy') g, 4 code from dual union all
                  select to_date('05/10/2009', 'dd/mm/yyyy') g, 4 code from dual union all
                  select to_date('05/11/2009', 'dd/mm/yyyy') g, 4 code from dual union all
                  select to_date('05/12/2009', 'dd/mm/yyyy') h, 5 code from dual)
    select cnt, to_char(to_date(mnt||'01', 'yyyymmdd'), 'Mon-yyyy')
      from (select count(*) cnt, to_char(s.pdate,'yyyymm') as mnt
              from sTable s
             group by to_char(s.pdate,'yyyymm')
             order by to_char(s.pdate,'yyyymm')
           CNT MONTH
             1 Jan-2009
             1 Feb-2009
             1 Mar-2009
             1 Apr-2009
             1 May-2009
             1 Jun-2009
             1 Jul-2009
             1 Aug-2009
             1 Sep-2009
             1 Oct-2009
             1 Nov-2009
             1 Dec-2009
    12 rows selectedyour problem was that you are using a expresión in the order by (to_date...) that is distinct to the query results (to_char...).
    Regards,
    Mike

  • Count(*) with group by and a join

    I've the below tables:
    Tables:
    EMPLOYEE
    EMP_ID         LNAME             FNAME
    1000                 SLITT              JOHN
    1001                 SLITHER              STEVE
    1002                 JACOB              MARLYN
    1003                 STUFFEY     NOSE
    1004                 SLIPPY              MOUTH-----
    ACCESS_TYPE
    ACCESS_TYPE_ID     ACCESS_DESCRIPTION
    1                         EMPLOYEE
    2                         EMPLOYEE_ADMIN
    3                         CONTRACTOR-----
    EMPLOYEE_ACCESS
    ACCESS_ID      ACCESS_TYPE_ID     EMP_ID     ACCESS_EFF_DATE     
    1               1               1000              01-JAN-13
    2               1               1001              10-FEB-13
    3               1               1002              18-FEB-13
    4               2               1003              10-OCT-12
    5               3               1004              10-MAR-08-----
    I'm trying to figure out the count of employees group by their type and whose last name does not start with SL
    I've written the query below and I'm getting a 00936 Missing Expression. What am I doing wrong? Thanks
    SELECT EA.COUNT(*) , ACCESS_TYPE_ID
    FROM EMPLOYEE_ACCESS EA, EMPLOYEE E
    WHERE ACCESS_EFF_DATE >= '31-DEC-12' AND E.LNAME NOT LIKE 'SL%'
    GROUP BY ACCESS_TYPE_ID;
    Edited by: parsar on Mar 25, 2013 3:54 PM

    thanks for the response.
    If I don't use the alias prefix, which table rows will the query count because I've two tables in the from clause.
    I've modified the query as below but it doesn't return any data:
    SELECT COUNT(*) AS ACCESS_COUNT, ACCESS_TYPE_ID
    FROM EMPLOYEE_ACCESS EA , EMPLOYEE E
    WHERE EA.EMP_ID=E.EMP_ID AND
    ACCESS_EFF_DATE >= TO_DATE('2012-12-31', 'YYYY-MM-DD') AND
    E.LNAME NOT LIKE 'SL%'
    GROUP BY ACCESS_TYPE_ID;Please let me know which part of the query I screwed up.

  • Incorrect warning when parsing query with group by clause

    I am using SQL Developer 4.0.0.13.80 with JDK 1.7.0_51 x64 on Windows 8.1
    I have the following SQL, which works perfectly:
    select substr(to_char(tot_amount), 0, 1) as digit, count(*)
    from transactions
    where tot_amount <> 0
    group by substr(to_char(tot_amount), 0, 1)
    order by digit;
    However, SQL Developer is yellow-underlining the first line, telling me that:
    SELECT list is inconsistent with GROUP BY; amend GROUP BY clause to: substr(to_char(rep_tot_amount), 0, 1), substr(to_char(rep_tot_amount),
    which is clearly wrong.
    Message was edited by: JamHan
    Added code formatting.

    Hello,
    I also have found the same issue with the GROUP BY hint. Another problem I found is that the hint suggests to amend the GROUP BY members to add also constant values that are included in the SELECTed columns and whenever those constants include strings with spaces, it generates an invalid query. Normally, constant values won't affect grouping functions and as such they can be omitted from the GROUP BY members, but it seems SQL Dev thinks it differently.
    For example, if you try the following query:
    SELECT d.DNAME, sum(e.sal) amt, 'Total salary' report_title, 100 report_nr
    FROM scott.emp e, scott.dept d
    WHERE e.DEPTNO = d.DEPTNO
    GROUP BY d.DNAME;
    when you hover the mouse pointer on the yellow hint, a popup will show the following message:
    SELECT list inconsistent with GROUP BY; amend GROUP BY clause to:
    d.DNAME, 'Total, 100
    If you click on the hint, it will amend the group by members to become:
    GROUP BY d.DNAME, 'Total, 100;
    that is clearly incorrect syntax. You may notice that after the change the yellow hint is still there, suggesting to amend further the GROUP BY members. If you click again on the hint, you will end with the following:
    GROUP BY d.DNAME, 'Total, 100;
    , 'Total, 100
    and so on.
    I am not sure if this behaviour was already known (Vadim??), but it would be nice if somebody could file a bug against it.
    Finally when writing big queries with complex functions and constant columns, those yellow lines extend all over the select list and they are visually annoying, so I wonder if there is a way to disable the GROUP BY hint until it gets fixed.
    Thanks for any suggestion,
    Paolo

  • Count(*) with group by max(date)

    SQL> select xdesc,xcust,xdate from coba1 order by xdesc,xcust,xdate;
    XDESC XCUST XDATE
    RUB-A 11026 01-JAN-06
    RUB-A 11026 05-JAN-06
    RUB-A 11026 08-JAN-06
    RUB-A 11027 10-JAN-06
    RUB-B 11026 02-JAN-06
    RUB-B 11026 08-JAN-06
    RUB-B 11026 09-JAN-06
    RUB-C 11027 08-JAN-06
    I want to make sql that result :
    XDESC     COUNT(*)
    RUB-A     2
    RUB-B 1
    RUB-C 1
    Criteria : GROUPING: XDESC XCUST AND MAX(DATE)
    bellow mark *** that was selected in count.
    XDESC XCUST XDATE
    RUB-A 11026 01-JAN-06
    RUB-A 11026 05-JAN-06
    RUB-A 11026 08-JAN-06 ***
    RUB-A 11027 10-JAN-06 ***
    ---------------------------------------------------------COUNT RUB-A = 2
    RUB-B 11026 02-JAN-06
    RUB-B 11026 08-JAN-06
    RUB-B 11026 09-JAN-06 ***
    ---------------------------------------------------------COUNT RUB-B = 1
    RUB-C 11027 08-JAN-06 ***
    --------------------------------------------------------COUNT RUB-C = 1
    Can Anybody help ?
    I tried :
    select xdesc,max(xdate),count(max(xdate)) from coba1 group by xdesc
    ERROR at line 1:
    ORA-00937: not a single-group group function
    Thank

    This one is duplicate. see the following link
    Count(*) with group by max(date)
    Thanks

  • How can I evaluate the count of a query I'd like to execute with a map...

    Hi. I have a problem with a query...
    I hava created a query which a execute with a Map (I use the
    executeWithMap(Map) method). The problem is that sometimes this query
    returns a large resultset. So, I would like to execute an other query
    (called query_count) before executing ther final query with the Map. If
    the query_count returns a count < 200, I execute the final query. How can
    I do ? There is an example I have read this in the documentation :
    Query query = pm.newQuery (Magazine.class, "price < 5");
    query.setResult ("count(this)");
    Long count = (Long) query.execute ();
    The problem in this example is that the query is not execute with a Map.
    So my question is : "How can we do the evalute the count of a query we
    would like to execute with a map ?". Thank you for any response.

    Hi John,
    You should be able to executeWithMap that query, too. Is that giving you
    problems?
    Note that there may be an easier solution. What do you do if there are more
    than 200 results? If, e.g., you just get the first N, then one option is to
    set the FetchBatchSize on the query to N (thus activating large result set
    support), and then call size () on the resulting Collection. This will
    issue a SELECT COUNT(*) to the database to determine the size automatically.
    Thanks,
    Greg
    "John" <[email protected]> wrote in message
    news:ctq9a8$4gr$[email protected]..
    >
    Hi. I have a problem with a query...
    I hava created a query which a execute with a Map (I use the
    executeWithMap(Map) method). The problem is that sometimes this query
    returns a large resultset. So, I would like to execute an other query
    (called query_count) before executing ther final query with the Map. If
    the query_count returns a count < 200, I execute the final query. How can
    I do ? There is an example I have read this in the documentation :
    Query query = pm.newQuery (Magazine.class, "price < 5");
    query.setResult ("count(this)");
    Long count = (Long) query.execute ();
    The problem in this example is that the query is not execute with a Map.
    So my question is : "How can we do the evalute the count of a query we
    would like to execute with a map ?". Thank you for any response.

  • Max, Min and Count with Group By

    Hello,
    i want the max, min and count of a table, which is grouped by a column
    I need a combination of these two selects:
    select
         max(COUNTRY_S) MAXVALUE,
         min(COUNTRY_S) MINVALUE
    from
         tab_Country
    select
         count(*)
    from
         (select COUNTRY_TXT from tab_Country group by COUNTRY_TXT) ;
    The result should be one row with the max and min value of the table and with the count of the grouped by table, not the max and min of each group! - i hope you understand my question?
    Is this possible in one SQL-select?
    Thank you very much
    Best regards
    Heidi

    Hi, Heidi,
    HeidiWeber wrote:
    Hello,
    i want the max, min and count of a table, which is grouped by a column
    I need a combination of these two selects:
    select 
         max(COUNTRY_S) MAXVALUE, 
         min(COUNTRY_S) MINVALUE 
    from 
         tab_Country 
    select 
         count(*) 
    from 
         (select COUNTRY_TXT from tab_Country group by COUNTRY_TXT) ; 
    The result should be one row with the max and min value of the table and with the count of the grouped by table, not the max and min of each group! - i hope you understand my question?
    Is this possible in one SQL-select?
    Thank you very much
    Best regards
    Heidi
    It's not clear what you want.  Perhaps
    SELECT  MAX (country_s)               AS max_country_s
    ,       MIN (country_s)               AS min_country_s
    ,       COUNT (DISTINCT country_txt)  AS count_country_txt
    FROM    tab_country
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Strange behavior in inner query with group by clause

    Hi All,
    I found a very strange behaviour with Inner query having a group by clause.
    Please look the sample code
    Select b,c,qty from (select a,b,c,sum(d) qty from tab_xyz group by b,c);
    This query gives output by summing b,c wise. But when i run the inner query it gives error as "not a group by expression "
    My question is - though the inner query is wrong, how is it possible that this query gives output.
    it behaves like -
    Select b,c,qty from (select b,c,sum(d) qty from tab_xyz group by b,c);
    Is it a normal behaviour ?
    If it is a normal behaviour, then how group by behaves inside a inner query.
    Thanks !!

    This case I have tested already and it throws error.
    But why the initial posted query is not throwing
    error even the inner query is wrong.
    In what way oracle behaves for the initial posted
    query?what is the scenario that throws the error? is it at the time when you only run the inner query or the whole query?

  • Using count function with grouped records

    Hi all,
    This seems like it should be real easy but I have yet to figure out a simple way to do this.
    Suppose I want to count Opportunities that are grouped by Sales Rep. At run-time I am filtering this list with a parameter for Sales Stage and created date.
    I've simplified this greatly, but here's what my setup looks like now:
    Sales Rep* ---------Count*_
    <?for-each-group:Opportunity[SalesStage=param1 and Created>param2];./salesrep?>
    <?salesrep?>-------<?count(current-group()/Id)?>
    <?end for-each-group?>
    Total_
    The only solution I have so far to get my grand total is to create a variable and keep a running total which I'll then display in the Total column. While it works, it seems like there should be an easier way, like doing a simple count(Id) to get the grand total. But since the Total appears after the end for-each-group, I lose the filter that was applied to the group so that count is invalid.
    Any thoughts from the experts?
    Thanks!

    To get grand total
    use
    <?count(/Oppurtunity[SalesStage=param1 and Created>param2]/Id)?>since you did not mention the complete xml, i assumed, Opportunity as the Root.
    if not, put the full path from the root.
    if you give some xml sample, and explain the output you wanted, we can fix it immediately.
    go thru these too..some thing can be pulled from here .
    http://winrichman.blogspot.com/search/label/Summation%20In%20BIP
    http://winrichman.blogspot.com/search/label/BIP%20Vertical%20sum

  • Wsus query needed - get WSUS-Computers, belonging WSUS-Group and Not Installed Count

    Hi,
    i try to find a way by using basic WSUS powershell cmds in combination with piping in Server 2012 R2 to get all registered computers in WSUS plus belonging WSUS-Group and Update "Not Installed Count" as output.
    Is that possible?
    I tried multiple times and enden up in using posh - is there no way based on standard powershell commandlets.
    Thank you
    Peter

    Hi Michael,
    it seems that you are right :(. I tried out a few things with powershell (source
    http://blogs.technet.com/b/heyscriptingguy/archive/2012/01/19/use-powershell-to-find-missing-updates-on-wsus-client-computers.aspx) - big problem is that i actually cant get belonging WSUS Group to Server object. I only are able to get all WSUS Groups
    but cant find the right sytax to get only belonging ones.
    Any ideas?
    Thanks
    Peter
    #Load assemblies
    [void][system.reflection.assembly]::LoadWithPartialName('Microsoft.UpdateServices.Administration')
    #Create Scope objects
    $computerscope = New-Object Microsoft.UpdateServices.Administration.ComputerTargetScope
    $updatescope = New-Object Microsoft.UpdateServices.Administration.UpdateScope
    #Gather only servers
    $ServersId = @($wsus.GetComputerTargets($computerscope) | Where {
    $_.OSDescription -like "*Server*"
    } | Select -expand Id)
    #Get Update Summary
    $wsus.GetSummariesPerComputerTarget($updatescope,$computerscope) | Where {
    #Filter out non servers
    $ServersId -Contains $_.ComputerTargetID
    } | ForEach {
    New-Object PSObject -Property @{
    ComputerTarget = ($wsus.GetComputerTarget([guid]$_.ComputerTargetId)).FullDomainName
    ComputerTargetGroupIDs = ($wsus.GetComputerTarget([guid]$_.ComputerTargetId)).ComputerTargetGroupIds
    ComputerTargetGroupNames = ($wsus.GetComputerTargetGroups())
    NeededCount = ($_.DownloadedCount + $_.NotInstalledCount)
    #DownloadedCount = $_.DownloadedCount
    NotInstalledCount = $_.NotInstalledCount
    #InstalledCount = $_.InstalledCount

Maybe you are looking for

  • Outgoing Payment - Bank transfer method default

    Where / how is the default G/L set on the Bank Transfer tab of the payment means on an outgoing payment?  I want it to default to a new banks G/L account but I can't seem to get it to change. Thanks

  • Reader X " display PDF in browser" is checked but greyed out

    Hello    I have a user who wanted to print double sided by default when opening a PDF on a web page. I found that by downloading the PDF, not printing from a browser, the user can print double- sided. But when I go in preferences the option to unchec

  • Installation Server Corruption when applying  a Patch

    I have setup a installation server with 7.10 gui.  I have twice tried to apply a patch, the first time bw350gui710_1 patch, the second time was the gui710_4 patch.  Both times my installation server was corrupted to the point where I had to delete it

  • Transaction F-22(Invoice - General) - program

    Hi,    Can anyone let me know if there is any program for posting document using F-22(Invoice - General) transaction. Please let me know. Thanks, SP

  • Video noise reduction software?

    Sorry... but I've asked this question in the Tiger OS forum about video noise reduction for iMovie HD 6 and/or QT files but haven't got far with it. If anyone on this forum has any suggestions about what I could use to reduce visual noise - basically