Find com_id where sum(invoice_total) not equal to zero within a month

How to find com_id where sum(invoice_total) not equal to zero within a month.
SQL> select com_id from invoice group by com_id
2 where sum(invoice_total) !=0
3 and invoice_date between ADD_MONTHS(sysdate,-1) and sysdate
SQL> desc invoice;
TID NOT NULL NUMBER
COM_ID NOT NULL NUMBER
BRANCH_ID NUMBER
INVOICE_OLD_NUM VARCHAR2(4000)
INVOICE_DATE NOT NULL DATE
INVOICE_PO_NUM VARCHAR2(4000)
INVOICE_TOTAL NOT NULL NUMBER(12,2)
TRANSPORT_ID NUMBER
PAID NOT NULL VARCHAR2(4000)
CHEQUE_CASH NOT NULL VARCHAR2(10)
REMARK VARCHAR2(4000)
Thanks
Francis

CREATE TABLE INVOICES(
TID NUMBER NOT NULL,
COM_ID NUMBER NOT NULL,
BRANCH_ID NUMBER,
INVOICE_OLD_NUM VARCHAR2(4000),
INVOICE_DATE DATE NOT NULL,
INVOICE_PO_NUM VARCHAR2(4000),
INVOICE_TOTAL NUMBER(12,2) NOT NULL,
TRANSPORT_ID NUMBER,
PAID VARCHAR2(4000) NOT NULL,
CHEQUE_CASH VARCHAR2(10) NOT NULL,
REMARK VARCHAR2(4000)
INSERT INTO INVOICES (
TID ,
COM_ID ,
BRANCH_ID ,
INVOICE_OLD_NUM ,
INVOICE_DATE ,
INVOICE_PO_NUM ,
INVOICE_TOTAL ,
TRANSPORT_ID ,
PAID ,
CHEQUE_CASH ,
REMARK
VALUES (
1,
1,
1,
'OLD_1',
SYSDATE -40,
'PO_1',
100,
1,
'Y',
'CASH',
'REMARK_1');
INSERT INTO INVOICES (
TID ,
COM_ID ,
BRANCH_ID ,
INVOICE_OLD_NUM ,
INVOICE_DATE ,
INVOICE_PO_NUM ,
INVOICE_TOTAL ,
TRANSPORT_ID ,
PAID ,
CHEQUE_CASH ,
REMARK
VALUES (
2,
2,
1,
'OLD_1',
SYSDATE -20,
'PO_1',
100,
1,
'Y',
'CASH',
'REMARK_1');
INSERT INTO INVOICES (
TID ,
COM_ID ,
BRANCH_ID ,
INVOICE_OLD_NUM ,
INVOICE_DATE ,
INVOICE_PO_NUM ,
INVOICE_TOTAL ,
TRANSPORT_ID ,
PAID ,
CHEQUE_CASH ,
REMARK
VALUES (
3,
3,
1,
'OLD_1',
SYSDATE -10,
'PO_1',
0,
1,
'Y',
'CASH',
'REMARK_3');
SELECT COM_ID,
               SUM(INVOICE_TOTAL)
     FROM INVOICES
WHERE INVOICE_DATE BETWEEN ADD_MONTHS(SYSDATE,
                                                                                               -1) AND SYSDATE
GROUP BY COM_ID
HAVING SUM(INVOICE_TOTAL) != 0;

Similar Messages

  • Produciton order status TECO, but WIP is not equal to zero

    Dear Expert,
    In OKGC,
    1000     0     000002     REL     2     WIP Calculation on Basis of Actual Costs
    1000     0     000002     DLV     3     Cancel Data of WIP Calculation and Results Ana
    1000     0     000002     PREL     1     WIP Calculation on Basis of Actual Costs
    *1000     0     000002     TECO     4     Cancel Data of WIP Calculation and Results Ana
    We checked produciton order status TECO (CO03)
    but WIP is not equal to zero (KKAO)
    Also, we found production order status show "rel" status in KKAO.
    Why order status in CO03 is TECO, but show "REL" in KKAO?
    Thanks in advance.

    Hi,
    We also had similar issue that the WIP is not equal to zero even though the status of the Process Order is DLV/TECO. When we analyzed, we found that few of the operations/resources/activityeps are not yet confirmed in the same month for the order. These operations/resources/activityeps are confirmed in subsequent month, then WIP got automatically Zero.
    Also refer the SAP Note 530563 - WIP calculation: Status DLV and TECO. Which provide the details for how WIP will get calculated.
    Thanks & regards,
    ADI

  • Finding accounts where child does not match Parent acct category

    Hi,
    I have an interesting problem. There is Parent Account Group with child accounts under it. The child accounts must
    have been assigned the SAME category as the Parent account. If they are not, then they must show-up on the mismatch report.
    So, if there is a Parent Acct 1 with childacct a AND childacct b and if childacct a has category of Base and childacct b has category of offshore, while Parent Acct 1 has category of Base, then because BOTH A AND B do NOT have the same category as assigned to its parent, it should show up on report.
    I can get all children but how do this: check if any ONE acct category is NOT the same as the Parent???
    DO I have to use If AcctCATPARENT <>ANY(CHILDcate). then select Acct ID from table ....will this work??
    This is urgent, any help is appreciated!!
    Regards,
    hena

    Hello
    if you have a problem please remember to post some create table statements along with inserts to provide sample data to work with. Also, remember to show what the output is you're expecting and what you've tried so far. And finally remember that this is a volunteer forum so there aren't any urgent requests.
    anyway, isn't it just a matter of joining between parent and child?....
    WITH parent_acc AS
    (    SELECT 1 ID, 'cat a' cat FROM dual UNION ALL
         SELECT 2 ID, 'cat b' cat FROM dual UNION ALL
         SELECT 3 ID, 'cat c' cat FROM dual UNION ALL
         SELECT 4 ID, 'cat d' cat FROM dual
    child_acc AS
    (   SELECT 1 ID, 1 parent_id, 'cat a' cat FROM dual UNION ALL
        SELECT 2 ID, 1 parent_id, 'cat a' cat FROM dual UNION ALL
        SELECT 3 ID, 2 parent_id, 'cat b' cat FROM dual UNION ALL
        SELECT 4 ID, 2 parent_id, 'cat b' cat FROM dual UNION ALL
        SELECT 5 ID, 3 parent_id, 'cat a' cat FROM dual UNION ALL
        SELECT 6 ID, 3 parent_id, 'cat c' cat FROM dual UNION ALL
        SELECT 7 ID, 4 parent_id, 'cat a' cat FROM dual UNION ALL
        SELECT 8 ID, 4 parent_id, 'cat d' cat FROM dual        
    SELECT
          p.ID parent_id,
          p.cat parent_cat,
          c.ID child_id,
          c.cat child_cat
    FROM
        parent_acc p
    JOIN
        child_acc c
    ON
        (   c.parent_id = p.ID
    WHERE
         c.cat != p.cat                 
    /David

  • Left join and where clause with not equal ( ) returns too many rows

    Say I have something like this
    Table A
    =========
    Id
    OrderNum
    Date
    StoreName
    AddressKey
    Table B
    ========
    Id
    StreetNumber
    City
    State
    select a.* from [Table A] a
    left join [Table B] b on a.AddressKey = b.Id
    where a.StoreName <> 'Burger place'
    The trouble is that the above query still returns rows that have StoreName = 'Burger place'
    One way Ive handled this is to use a table expression, select everything into that, then select from the CTE and apply the filter there.  How could you handle it in the same query however?

    Hi Joe,
    Thanks for your notes.
    INT SURROGATE PRIMARY KEY provides a small footprint JOIN ON column. Hence performance gain and simple JOIN programming.  In the Addresses table, address_id is 4 bytes as opposed to 15 bytes san. Similarly for the Orders table.
    INT SURROGATE PRIMARY KEY is a meaningless number which can be duplicated at will in other tables as FOREIGN KEY.  Having a meaningful PRIMARY KEY violates the RDBMS basics about avoiding data duplication.  If I make CelebrityName (Frank Sinatra)
    a PRIMARY KEY, I have to duplicate "Frank Sinatra" as an FK wherever it needed as opposed to duplicating SURROGATE PRIMARY KEY CelebrityID (79) a meaningless number.
    This is how we design in SQL Server world.
    QUOTE from Wiki: "
    Advantages[edit]
    Immutability[edit]
    Surrogate keys do not change while the row exists. This has the following advantages:
    Applications cannot lose their reference to a row in the database (since the identifier never changes).
    The primary or natural key data can always be modified, even with databases that do not support cascading updates across related
    foreign keys.
    Requirement changes[edit]
    Attributes that uniquely identify an entity might change, which might invalidate the suitability of natural keys. Consider the following example:
    An employee's network user name is chosen as a natural key. Upon merging with another company, new employees must be inserted. Some of the new network user names create conflicts because their user names were generated independently (when the companies
    were separate).
    In these cases, generally a new attribute must be added to the natural key (for example, an
    original_company column). With a surrogate key, only the table that defines the surrogate key must be changed. With natural keys, all tables (and possibly other, related software) that use the natural key will have to change.
    Some problem domains do not clearly identify a suitable natural key. Surrogate key avoids choosing a natural key that might be incorrect.
    Performance[edit]
    Surrogate keys tend to be a compact data type, such as a four-byte integer. This allows the database to query the single key column faster than it could multiple columns. Furthermore a non-redundant distribution of keys causes the resulting
    b-tree index to be completely balanced. Surrogate keys are also less expensive to join (fewer columns to compare) than
    compound keys.
    Compatibility[edit]
    While using several database application development systems, drivers, and
    object-relational mapping systems, such as
    Ruby on Rails or
    Hibernate, it is much easier to use an integer or GUID surrogate keys for every table instead of natural keys in order to support database-system-agnostic operations and object-to-row mapping.
    Uniformity[edit]
    When every table has a uniform surrogate key, some tasks can be easily automated by writing the code in a table-independent way.
    Validation[edit]
    It is possible to design key-values that follow a well-known pattern or structure which can be automatically verified. For instance, the keys that are intended to be used in some column of some table might be designed to "look differently from"
    those that are intended to be used in another column or table, thereby simplifying the detection of application errors in which the keys have been misplaced. However, this characteristic of the surrogate keys should never be used to drive any of the logic
    of the applications themselves, as this would violate the principles of
    Database normalization"
    LINK: http://en.wikipedia.org/wiki/Surrogate_key
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Database Design
    New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014

  • Statistical data disappears from companies where LC does not equal GC

    Hi experts : )
    We have come across an issue which we cannot explain and I was hoping some you might have encountered it before and can help.
    We are entering statistical data for payroll and JV cash and debt for example. We recently changed a few companies local currency from EUR to GBP. Since the change whenever statistical data is entered in those companies the values entered disapear after a while. My guess is that it is happening whenever the data collection task is executed. But what is strange is that is it only happening to the non-euro companies.
    Any idea anybody what is causing this?
    Your help is very much appreciated.
    Regards,
    Tanja

    Thank you very much for your answers : )
    The change of currency did take place in period 1/2011 and the BCF was configured as mentioned by Dan. However, we decided against running balance carried forward task in the end for those companies as we had difficulies matching the local currency amounts as converted by the BCT and the local currecy amount coming in from the source system. Instead the opening balances were loaded, but it seems the statistical data was not.
    But then again... we already had GBP companies in period 12/2010, but their statistical data is disappearing also even though their BCF was run... Any ideas on this particular case?
    Kind regards,
    Tanja

  • MIRO Balance is not equal to zero

    Hi
    The scenario is that the PO was in (foreign currecy) USD. GR in local currency AED. Now the vendor has sent invoice in local currency AED which is fine since we can post MIRO in local curreny. But while posting MIRO when we do unplanned delivery cost in Details tab and try to post it throws us following msg even though the traffic light is green and balance shows zero.
    Balance in transaction currency
    Message no. F5702
    Diagnosis
    A balance has occurred in transaction currency 'AED' with the following details:
    Exchange rate '00', amount '200.00' and currency key 'AED'.
    The data in the transaction currency were transferred from the calling application.
    System Response
    Your data cannot be processed in FI.
    Procedure
    The error is probably in the calling application.
    Edited by: SafiAkhtar on Dec 30, 2010 11:13 AM
    Edited by: SafiAkhtar on Dec 30, 2010 11:14 AM
    Edited by: SafiAkhtar on Dec 30, 2010 11:15 AM

    The Exchange rate in OB08 for AED to USD and USD to AED is already there.
    The procurement dept did not know that the vendor could invoice in local currency. The GRIR for PO is partially done and it is not allowing to change currency in PO anymore.
    The problem does not come for normal IRin local currency as it gets exchange rate from TCURR and works fine, its only that when we try to put in value in unplanned delivery cost then it throws us above error.
    Edited by: SafiAkhtar on Jan 2, 2011 7:22 AM

  • Balance not equal to Zero:0.01 usd

    hi frnds,
    i am getting this error while i try to post invoice in miro...
    could you guys temme what might be the exact issue here?
    Thanks in advance.....
    regards,
    venkatesh.v

    hi
    but in the balance field it is showing value as 0.00 with green  sign........but still getting the same error msg......
    plz help...
    Regards,
    Venkaetsh.V

  • ERROR:  Local Currency does not equal Group Currency within line item(s)

    Hello SAP Gurus,
    I am getting the above error message while scraping the asset using ABAVN.
    Please help me.
    Many Thanks,
    Bob

    hi
    check your depreciation area settings for the Currencies.
    also check your company code has parallel currencies & Check whether foreign currency translation is maintained in the table.

  • Where data not equal to something

    Guys how to retrieve record where emp_name is not equal to 'GEORGE_BUSH';
    I mean
    select emp_name from emp where emp_name != 'george';
    ignores emp_name = null too.
    what is the correct syntax.
    thanks
    ms

    When you compare anything to NULL, the result is false. You need to explicitly account for NULL values, i.e.
    SELECT emp_name
      FROM emp
    WHERE emp_name != 'george'
        OR emp_name IS NULLJustin

  • Bapi Fm BAPI_INCOMINGINVOICE_CREATE Giving error *Balance is not equal to .

    Dear All,
    Note: Cin as implemetned.
                   Get error from Fm BAPI_INCOMINGINVOICE_CREATE  is Balance is not equal to zero.
    Have passed the correct inputs to the Fm its Invoice is creting ,while the only case Cenvat comes based in the PO/Vendor that time  error is generating.
    Passing values : HEADER LEVEL : Grand total value (item + tax value + cenvat value).
                                item level : total value of item price.
                                tax account : bed,escess, bcs. cenvat value and taxcode. 
    For rest of the case which is not having in the Cenvat some value type passed invoice no is generating.
    Please Suggest me to come out from this issues. How to pass the value in case cenvat.
    Regards,
    Santosh
    Edited by: santosh jajur on Mar 10, 2010 10:43 AM
    Edited by: santosh jajur on Mar 10, 2010 10:44 AM

    Hi
    I encountered Same problem in different BAPI.
    It been solved by turning one of sums to negative.
    I don't familiar with this specific BAPI but mayby this will help to you to.
    Best Regards
    Yossi Rozenberg

  • SQL query using not equal to or not exists

    Hi All;
    From the  below table , i need to display the client name 
    where output is not equal to Pre Start, BA
    but display client with output only with SOSP
    so only in the below example DEF client name will be displayed
    below is my query
    select C.new_applicationformid,
    C.clientname ,
    C.new_noofappointments
    From (
    Select A.new_applicationformid ,A.new_programmecontractidname,Count(1) As Cnt
    from FilteredNew_applicationform as a
    full outer join filteredNew_Evidence as aa on (a.new_applicationformid = aa.new_relatedapplicationid)
    Group By A.new_applicationformid ,A.new_programmecontractidname
    Having Count(1) >= 1) A
    Inner Join filteredNew_Evidence AA on a.new_applicationformid = aa.new_relatedapplicationid
    Inner Join FilteredNew_applicationform C on C.new_applicationformid = aa.new_relatedapplicationid
    Where ((aa.output in ('SOSP'))
    and (aa.output not in ('Pre Start','BA') )
    Any help much appreciated
    Thanks
    Pradnya07

    See examples written by Joe Celko to help you out
    CREATE TABLE PilotSkills 
    (pilot CHAR(15) NOT NULL, 
     plane CHAR(15) NOT NULL, 
     PRIMARY KEY (pilot, plane));
    PilotSkills 
    pilot    plane 
    =========================
    'Celko'    'Piper Cub'
    'Higgins'  'B-52 Bomber'
    'Higgins'  'F-14 Fighter'
    'Higgins'  'Piper Cub'
    'Jones'    'B-52 Bomber'
    'Jones'    'F-14 Fighter'
    'Smith'    'B-1 Bomber'
    'Smith'    'B-52 Bomber'
    'Smith'    'F-14 Fighter'
    'Wilson'   'B-1 Bomber'
    'Wilson'   'B-52 Bomber'
    'Wilson'   'F-14 Fighter'
    'Wilson'   'F-17 Fighter'
    CREATE TABLE Hangar
    (plane CHAR(15) NOT NULL PRIMARY KEY);
    Hangar
    plane 
    =============
    'B-1 Bomber'
    'B-52 Bomber'
    'F-14 Fighter'
    PilotSkills DIVIDED BY Hangar
    pilot
    =============================
    'Smith'
    'Wilson'
    SELECT DISTINCT pilot  
      FROM PilotSkills AS PS1
     WHERE NOT EXISTS 
           (SELECT *
              FROM Hangar
             WHERE NOT EXISTS 
                   (SELECT *
                      FROM PilotSkills AS PS2
                     WHERE (PS1.pilot = PS2.pilot)
                       AND (PS2.plane = Hangar.plane)));
    SELECT PS1.pilot 
       FROM PilotSkills AS PS1, Hangar AS H1
      WHERE PS1.plane = H1.plane
      GROUP BY PS1.pilot 
     HAVING COUNT(PS1.plane) = (SELECT COUNT(plane) FROM Hangar);
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • 12.3 - 12.3  is not equal to 0??

    I am trying to calculate the result of two Numbers
    ((Float)f).floatValue() - ((Double)d).doubleValue(), where f is equal to d.
    However the result is not equal to zero.
    I've tried to print out (12.3f - 12.3d) the result is not equal to zero too. I think it is a bug when Java do type promotion, right?
    How can I get around of it?
    Germen

    abs( a - b ) < delta,The problem with comparing numbers that way is that delta doesn't scale as a and b scale. The delta required when a and b are near 1e-10 is quite different form that when they are 1e10.
    A better way to write an inexact comparison is:
    a == b || abs(a - b) < max(a, b) * delta
    This improved code also handles infinities and zeroes correctly as well as scaling as a and b scale.
    Knuth gives a much more rigorous definition of inexact floating point comparison in The Art of Computer Programming.

  • Select only records where column values are not all equal to zero

    Hi everyone, this seems so easy but it's got me stumped on finding a clean, easy way to accomplish this. I'm sure when someone responds, I'll kick myself. So, assume the following is what I've got:
    with mytable as (
    select 'Type 1' as itemtype, 'JAN' as monthname, 0 as theval from dual union all
    select 'Type 1' as itemtype, 'FEB' as monthname, 1 as theval from dual union all
    select 'Type 1' as itemtype, 'MAR' as monthname, 5 as theval from dual union all
    select 'Type 1' as itemtype, 'APR' as monthname, 1 as theval from dual union all
    select 'Type 1' as itemtype, 'MAY' as monthname, 4 as theval from dual union all
    select 'Type 1' as itemtype, 'JUL' as monthname, 0 as theval from dual union all
    select 'Type 1' as itemtype, 'AUG' as monthname, 0 as theval from dual union all
    select 'Type 1' as itemtype, 'SEP' as monthname, 1 as theval from dual union all
    select 'Type 1' as itemtype, 'OCT' as monthname, 7 as theval from dual union all
    select 'Type 1' as itemtype, 'NOV' as monthname, 1 as theval from dual union all
    select 'Type 1' as itemtype, 'DEC' as monthname, 2 as theval from dual union all
    select 'Type 2' as itemtype, 'JAN' as monthname, 0 as theval from dual union all
    select 'Type 2' as itemtype, 'FEB' as monthname, 0 as theval from dual union all
    select 'Type 2' as itemtype, 'MAR' as monthname, 0 as theval from dual union all
    select 'Type 2' as itemtype, 'APR' as monthname, 0 as theval from dual union all
    select 'Type 2' as itemtype, 'MAY' as monthname, 0 as theval from dual union all
    select 'Type 2' as itemtype, 'OCT' as monthname, 0 as theval from dual union all
    select 'Type 2' as itemtype, 'NOV' as monthname, 0 as theval from dual union all
    select 'Type 2' as itemtype, 'DEC' as monthname, 0 as theval from dual
    select
      itemtype,
      sum (case monthname when 'JAN' then theval else 0 end) as JAN,
      sum (case monthname when 'FEB' then theval else 0 end) as FEB,
      sum (case monthname when 'MAR' then theval else 0 end) as MAR,
      sum (case monthname when 'APR' then theval else 0 end) as APR,
      sum (case monthname when 'MAY' then theval else 0 end) as MAY,
      sum (case monthname when 'JUN' then theval else 0 end) as JUN,
      sum (case monthname when 'JUL' then theval else 0 end) as JUL,
      sum (case monthname when 'AUG' then theval else 0 end) as AUG,
      sum (case monthname when 'SEP' then theval else 0 end) as SEP,
      sum (case monthname when 'OCT' then theval else 0 end) as OCT,
      sum (case monthname when 'NOV' then theval else 0 end) as NOV,
      sum (case monthname when 'DEC' then theval else 0 end) as DEC
    from mytable
    group by itemtype
    order by itemtypeI need an outer query around this one or something that will only select "Type 1"... i.e., if all of the months are each equal to zero, don't include the record in the result set.
    Summing them to get a total of zero is not an option, as I could have -15 and +15 in different columns, in which case, that record would need to be displayed.
    Something as simple as... "where not (oct = 0 and nov = 0 and dec = 0...) at the end is all I seem to need. I've thought about adding a case clause for each column, but that doesn't seem very efficient. Ideas?
    Thanks in advance!
    Mark
    Edit... I know the following will work using the MINUS operator, but my real query is really huge, and I don't want to have to write it twice...
    {code}
    select
    itemtype,
    sum (case monthname when 'JAN' then theval else 0 end) as JAN,
    sum (case monthname when 'FEB' then theval else 0 end) as FEB,
    sum (case monthname when 'MAR' then theval else 0 end) as MAR,
    sum (case monthname when 'APR' then theval else 0 end) as APR,
    sum (case monthname when 'MAY' then theval else 0 end) as MAY,
    sum (case monthname when 'JUN' then theval else 0 end) as JUN,
    sum (case monthname when 'JUL' then theval else 0 end) as JUL,
    sum (case monthname when 'AUG' then theval else 0 end) as AUG,
    sum (case monthname when 'SEP' then theval else 0 end) as SEP,
    sum (case monthname when 'OCT' then theval else 0 end) as OCT,
    sum (case monthname when 'NOV' then theval else 0 end) as NOV,
    sum (case monthname when 'DEC' then theval else 0 end) as DEC
    from mytable
    group by itemtype
    minus
    select
    itemtype,
    jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec
    from (
    select
    itemtype,
    sum (case monthname when 'JAN' then theval else 0 end) as JAN,
    sum (case monthname when 'FEB' then theval else 0 end) as FEB,
    sum (case monthname when 'MAR' then theval else 0 end) as MAR,
    sum (case monthname when 'APR' then theval else 0 end) as APR,
    sum (case monthname when 'MAY' then theval else 0 end) as MAY,
    sum (case monthname when 'JUN' then theval else 0 end) as JUN,
    sum (case monthname when 'JUL' then theval else 0 end) as JUL,
    sum (case monthname when 'AUG' then theval else 0 end) as AUG,
    sum (case monthname when 'SEP' then theval else 0 end) as SEP,
    sum (case monthname when 'OCT' then theval else 0 end) as OCT,
    sum (case monthname when 'NOV' then theval else 0 end) as NOV,
    sum (case monthname when 'DEC' then theval else 0 end) as DEC
    from mytable
    group by itemtype
    where ( oct = 0 and nov = 0 and dec = 0 and jan = 0 and feb = 0 and mar = 0
    and apr = 0 and may = 0 and jun = 0 and jul = 0 and aug = 0 and sep = 0
    order by itemtype
    {code}
    Edit again... Ok, I guess I'm answering my own question here, but I think using a WITH clause to write the main query once and then selecting * from it twice using the MINUS operator in between where the second query has where (oct = 0, etc.) is what I need. If anyone else has better suggestions, please do let me know! Here's the pseudo logic for what I've come up with so far...
    {code}
    WITH mainquery as (select everything)
    select * from mainquery
    minus
    select * from mainquery where (oct = 0, nov = 0, etc...)
    {code}
    Thanks again!
    Mark
    Edited by: user455268 on Mar 1, 2012 7:13 PM
    Edited by: user455268 on Mar 1, 2012 7:16 PM

    Hi,
    You can do that with a HAVING clause:
    select
      itemtype,
      sum (case monthname when 'JAN' then theval else 0 end) as JAN,
      sum (case monthname when 'FEB' then theval else 0 end) as FEB,
      sum (case monthname when 'MAR' then theval else 0 end) as MAR,
      sum (case monthname when 'APR' then theval else 0 end) as APR,
      sum (case monthname when 'MAY' then theval else 0 end) as MAY,
      sum (case monthname when 'JUN' then theval else 0 end) as JUN,
      sum (case monthname when 'JUL' then theval else 0 end) as JUL,
      sum (case monthname when 'AUG' then theval else 0 end) as AUG,
      sum (case monthname when 'SEP' then theval else 0 end) as SEP,
      sum (case monthname when 'OCT' then theval else 0 end) as OCT,
      sum (case monthname when 'NOV' then theval else 0 end) as NOV,
      sum (case monthname when 'DEC' then theval else 0 end) as DEC
    from mytable
    group by itemtype
    HAVING      MIN (theval)     != 0
    OR      MAX (theval)     != 0
    order by itemtype
    ;If the values are all 0, then the MIN and the MAX will both be 0.
    If either the MIN or the MAX is not 0, then the values are not all 0.
    This assumes that the combination (itemtype, monthname) is unique, as it is in your sample data.
    If that's not the case, start with a subquery that GROUPs BY itemtype, monthname, so that, when you get to the main query, that combination will be unique.

  • Total Baseline Hours For A Resource Does Not Equal the Sum of the Weekly Baseline Hours for that Resource

    Hi,
    I am using Project Server 2010. I have a project schedule that has been baselined and no actual work has been charged to it. The project has 3 resources. I am in the Resource Usage View. With 2 of the three resources, the hours in the Baseline Work Column
    on the left side of the view do not equal the sum total of weekly hours in the Timephased Grid. For instance, for resource JB the Baseline Work hours column says 1,392. When I total his weekly hours in the timephased grid I get 1368 hours; a variance
    of 24. Resource RS has 794.5 hours in the Baseline Work column but the sum total of his weekly timephased grid hours is 710.5, a variance of 84 hours. In both cases, the sum of the hours in the timephased grid is less than the hours in the Baseline Work column.
    What would be causing this? (I am cutting and pasting the weekly hours in the timephased grid into Excel and using the Excel sum function total).  Is there a better timephased view I should be looking at to try to find the "missing
    hours"? I have seen this before in project and it really has me stumped. Thanks.
    Judy Washington

    Hi Judy,
    I could not reproduce your issue. Is your Project Server patched with the latest SP and CU?
    Also can you reproduce this unexpected behavior with another project?
    Can you split your screen from the resource usage view, display the resource form and click right on the grey part selecting "schedule"? Then you'll have the scheduled start and finish dates for the resource's assignments. This is to be sure that
    you are not missing any parts of the assignments due to a wrong zoom in the timephased grid.
    Hope this helps,
    Guillaume Rouyre, MBA, MCP, MCTS |

  • TS4002 I'm trying to create a new apple-id but when typing the email adress I want to use I'm told that the particular email adress is not allowed but when searching I can't find same being used. How do I find out where that particular email adress is use

    I'm trying to create a new apple-id but when typing the email adress I want to use I'm told that the particular email adress is not allowed When searching I can't find same being used anywhere. How do I find out where that particular email adress is used so I can delete it there and use it for my new apple-id?

    Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
    iOS: Wrong passcode results in red disabled screen                         
    If recovery mode does not work try DFU mode.                        
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings        
    For how to restore:
    iTunes: Restoring iOS software
    To restore from backup see:
    iOS: How to back up     
    If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
    You can redownload most iTunes purchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store        
    Also
    If you have Find My iPhone enabled, you can use Remote Wipe to erase the contents of your device. If you have been using iCloud to back up, you may be able to restore the most recent backup to reset the passcode after the device has been erased.

Maybe you are looking for