Help with summing rows

I really need some help! I have a form has a lot of rows and columns. I know how to sum them using Formcalc, but it would be tedious and time-consuming to do it again and again for all my fields.
So, here's kind of how the form looks like:
                                             January           February       March              .......       Total Year
Recyclable Amount
Waste Amount
                                                                                Total Tons
What I was doing was something like this: Sum(January[0], February[0]....December[0]) under "Total Year". But I would have to repeat this about 20 times for different rows. Is there a script to easily sum across the row, so I don't have to manually change the numbers in the bracket each row? Thanks! I know this might sound confusing, so let me know if my question isn't clear... Thanks in advance!!

I really need some help! I have a form has a lot of rows and columns. I know how to sum them using Formcalc, but it would be tedious and time-consuming to do it again and again for all my fields.
So, here's kind of how the form looks like:
                                             January           February       March              .......       Total Year
Recyclable Amount
Waste Amount
                                                                                Total Tons
What I was doing was something like this: Sum(January[0], February[0]....December[0]) under "Total Year". But I would have to repeat this about 20 times for different rows. Is there a script to easily sum across the row, so I don't have to manually change the numbers in the bracket each row? Thanks! I know this might sound confusing, so let me know if my question isn't clear... Thanks in advance!!

Similar Messages

  • Need help with Pivoting rows to columns

    Hi,
    I need help with pivoting rows to columns. I know there are other posts regarding this, but my requirement is more complex and harder. So, please give me a solution for this.
    There are two tables say Table 1 and Table 2.
    Table1
    name address email identifier
    x e g 1
    f s d 2
    h e n 3
    k l b 4
    Table2
    identifier TRno zno bzid
    1 T11 z11 b11
    1 T12 z12 b12
    1 T13 z13 b13
    2 T21 z21 b21
    2 T22 z22 b22
    As you can see the identifier is the column that we use to map the two tables. The output should be like below
    output
    name address email identifier TRno1 zno1 bzid1 TRno2 zno2 bzid2 TRno3 zno3 bzid3
    x e g 1 T11 z11 b11 T12 z12 b12 T13 z13 b13
    f s d 2 T21 z21 b21 t22 z22 b22
    Also we do not know exactly how many TRno's, zno's, etc each value in the identifier will have. There may be only 1 TRNO, zno and bzid, or there may be four.
    All the values must be in separate columns, and not be just comma delimitted. There are also other conditions that i have to add to restrict the data.
    So, can you please tell me what is should use to get the data in the required format? We are using Oracle 10g. Please let me know if u need any more information

    Something like this ?
    SCOTT@orcl> ed
    Wrote file afiedt.buf
      1  select a.name,
      2  a.address,
      3  a.email,
      4  b.* from (
      5  select distinct identifier
      6  ,max(trno1) trno1
      7  ,max(zno1) zno1
      8  ,max(bzid1) bzid1
      9  ,max(trno2) trno2
    10  ,max(zno2) zno2
    11  ,max(bzid2) bzid2
    12  ,max(trno3) trno3
    13  ,max(zno3) zno3
    14  ,max(bzid3) bzid3
    15  ,max(trno4) trno4
    16  ,max(zno4) zno4
    17  ,max(bzid4) bzid4
    18  from (select identifier
    19  ,decode(rn,1,trno,null) trno1
    20  ,decode(rn,1,zno,null) zno1
    21  ,decode(rn,1,bzid,null) bzid1
    22  ,decode(rn,2,trno,null) trno2
    23  ,decode(rn,2,zno,null) zno2
    24  ,decode(rn,2,bzid,null) bzid2
    25  ,decode(rn,3,trno,null) trno3
    26  ,decode(rn,3,zno,null) zno3
    27  ,decode(rn,3,bzid,null) bzid3
    28  ,decode(rn,4,trno,null) trno4
    29  ,decode(rn,4,zno,null) zno4
    30  ,decode(rn,4,bzid,null) bzid4
    31  from (select identifier,
    32  trno,bzid,zno,
    33  dense_rank() over(partition by identifier order by trno,rownum) rn
    34  from table2)
    35  order by identifier)
    36  group by identifier) b,table1 a
    37* where a.identifier=b.identifier
    SCOTT@orcl> /
    NAME       ADDRESS    EMAIL      IDENTIFIER TRNO1      ZNO1       BZID1      TRNO2      ZNO2       BZID2      TRNO3      ZNO3       BZID3      TRNO4      ZNO4       BZID4
    x          e          g          1          T11        z11        b11        T12        z12        b12        T13        z13        b13
    f          s          d          2          T21        z21        b21        T22        z22        b22
    SCOTT@orcl> select * from table1;
    NAME       ADDRESS    EMAIL      IDENTIFIER
    x          e          g          1
    f          s          d          2
    h          e          n          3
    k          l          b          4
    SCOTT@orcl> select * from table2;
    IDENTIFIER TRNO       ZNO        BZID
    1          T11        z11        b11
    1          T12        z12        b12
    1          T13        z13        b13
    2          T21        z21        b21
    2          T22        z22        b22
    SCOTT@orcl>Regards
    Girish Sharma

  • Need help with inserting rows in ResultSet and JTable

    hello Guru!
    i have inserted a row in my result set and i want that my table shows this row promptly after i have inserted it in my result set...
    but when i use following code for my resultset:
    rs.moveToInsertRow();
    rs.updateInt(1,nr);
    rs.updateString(2, name);
    rs.insertRow();
    Record are inserted in resultset and database but not shown in my JTable??
    Anyone a Clue to without reexecuting the query how can i display inserted row in JTable
    http://download-west.oracle.com/docs/cd/A87860_01/doc/java.817/a83724/resltse7.h
    I have refrered the following links but still clue less help Guruuuuuuu
    i m really in trobble??????

    i am just near by the Solution using the Database Metadata
    by couldn't get the ideaaaa
    ==================================================
    http://download-west.oracle.com/docs/cd/A87860_01/doc/java.817/a83724/resltse7.htm
    Seeing Database Changes Made Internally and Externally
    This section discusses the ability of a result set to see the following:
    its own changes (DELETE, UPDATE, or INSERT operations within the result set), referred to as internal changes
    changes made from elsewhere (either from your own transaction outside the result set, or from other committed transactions), referred to as external changes
    Near the end of the section is a summary table.
    Note:
    External changes are referred to as "other's changes" in the Sun Microsystems JDBC 2.0 specification.
    Seeing Internal Changes
    The ability of an updatable result set to see its own changes depends on both the result set type and the kind of change (UPDATE, DELETE, or INSERT). This is discussed at various points throughout the "Updating Result Sets" section beginning on , and is summarized as follows:
    Internal DELETE operations are visible for scrollable result sets (scroll-sensitive or scroll-insensitive), but are not visible for forward-only result sets.
    After you delete a row in a scrollable result set, the preceding row becomes the new current row, and subsequent row numbers are updated accordingly.
    Internal UPDATE operations are always visible, regardless of the result set type (forward-only, scroll-sensitive, or scroll-insensitive).
    Internal INSERT operations are never visible, regardless of the result set type (neither forward-only, scroll-sensitive, nor scroll-insensitive).
    An internal change being "visible" essentially means that a subsequent getXXX() call will see the data changed by a preceding updateXXX() call on the same data item.
    JDBC 2.0 DatabaseMetaData objects include the following methods to verify this. Each takes a result set type as input (ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE, or ResultSet.TYPE_SCROLL_INSENSITIVE).
    boolean ownDeletesAreVisible(int) throws SQLException
    boolean ownUpdatesAreVisible(int) throws SQLException
    boolean ownInsertsAreVisible(int) throws SQLException
    Note:
    When you make an internal change that causes a trigger to execute, the trigger changes are effectively external changes. However, if the trigger affects data in the row you are updating, you will see those changes for any scrollable/updatable result set, because an implicit row refetch occurs after the update.
    Seeing External Changes
    Only a scroll-sensitive result set can see external changes to the underlying database, and it can only see the changes from external UPDATE operations. Changes from external DELETE or INSERT operations are never visible.
    Note:
    Any discussion of seeing changes from outside the enclosing transaction presumes the transaction itself has an isolation level setting that allows the changes to be visible.
    For implementation details of scroll-sensitive result sets, including exactly how and how soon external updates become visible, see "Oracle Implementation of Scroll-Sensitive Result Sets".
    JDBC 2.0 DatabaseMetaData objects include the following methods to verify this. Each takes a result set type as input (ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE, or ResultSet.TYPE_SCROLL_INSENSITIVE).
    boolean othersDeletesAreVisible(int) throws SQLException
    boolean othersUpdatesAreVisible(int) throws SQLException
    boolean othersInsertsAreVisible(int) throws SQLException
    Note:
    Explicit use of the refreshRow() method, described in "Refetching Rows", is distinct from this discussion of visibility. For example, even though external updates are "invisible" to a scroll-insensitive result set, you can explicitly refetch rows in a scroll-insensitive/updatable result set and retrieve external changes that have been made. "Visibility" refers only to the fact that the scroll-insensitive/updatable result set would not see such changes automatically and implicitly.
    Visibility versus Detection of External Changes
    Regarding changes made to the underlying database by external sources, there are two similar but distinct concepts with respect to visibility of the changes from your local result set:
    visibility of changes
    detection of changes
    A change being "visible" means that when you look at a row in the result set, you can see new data values from changes made by external sources to the corresponding row in the database.
    A change being "detected", however, means that the result set is aware that this is a new value since the result set was first populated.
    With Oracle8i release 8.1.6 and higher, even when an Oracle result set sees new data (as with an external UPDATE in a scroll-sensitive result set), it has no awareness that this data has changed since the result set was populated. Such changes are not "detected".
    JDBC 2.0 DatabaseMetaData objects include the following methods to verify this. Each takes a result set type as input (ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE, or ResultSet.TYPE_SCROLL_INSENSITIVE).
    boolean deletesAreDetected(int) throws SQLException
    boolean updatesAreDetected(int) throws SQLException
    boolean insertsAreDetected(int) throws SQLException
    It follows, then, that result set methods specified by JDBC 2.0 to detect changes--rowDeleted(), rowUpdated(), and rowInserted()--will always return false with the 8.1.6 Oracle JDBC drivers. There is no use in calling them.
    Summary of Visibility of Internal and External Changes
    Table 12-1 summarizes the discussion in the preceding sections regarding whether a result set object in the Oracle JDBC implementation can see changes made internally through the result set itself, and changes made externally to the underlying database from elsewhere in your transaction or from other committed transactions.
    Table 12-1 Visibility of Internal and External Changes for Oracle JDBC
    Result Set Type Can See Internal DELETE? Can See Internal UPDATE? Can See Internal INSERT? Can See External DELETE? Can See External UPDATE? Can See External INSERT?
    forward-only
    no
    yes
    no
    no
    no
    no
    scroll-sensitive
    yes
    yes
    no
    no
    yes
    no
    scroll-insensitive
    yes
    yes
    no
    no
    no
    no
    For implementation details of scroll-sensitive result sets, including exactly how and how soon external updates become visible, see "Oracle Implementation of Scroll-Sensitive Result Sets".
    Notes:
    Remember that explicit use of the refreshRow() method, described in "Refetching Rows", is distinct from the concept of "visibility" of external changes. This is discussed in "Seeing External Changes".
    Remember that even when external changes are "visible", as with UPDATE operations underlying a scroll-sensitive result set, they are not "detected". The result set rowDeleted(), rowUpdated(), and rowInserted() methods always return false. This is further discussed in "Visibility versus Detection of External Changes".
    Oracle Implementation of Scroll-Sensitive Result Sets
    The Oracle implementation of scroll-sensitive result sets involves the concept of a window, with a window size that is based on the fetch size. The window size affects how often rows are updated in the result set.
    Once you establish a current row by moving to a specified row (as described in "Positioning in a Scrollable Result Set"), the window consists of the N rows in the result set starting with that row, where N is the fetch size being used by the result set (see "Fetch Size"). Note that there is no current row, and therefore no window, when a result set is first created. The default position is before the first row, which is not a valid current row.
    As you move from row to row, the window remains unchanged as long as the current row stays within that window. However, once you move to a new current row outside the window, you redefine the window to be the N rows starting with the new current row.
    Whenever the window is redefined, the N rows in the database corresponding to the rows in the new window are automatically refetched through an implicit call to the refreshRow() method (described in "Refetching Rows"), thereby updating the data throughout the new window.
    So external updates are not instantaneously visible in a scroll-sensitive result set; they are only visible after the automatic refetches just described.
    For a sample application that demonstrates the functionality of a scroll-sensitive result set, see "Scroll-Sensitive Result Set--ResultSet5.java".
    Note:
    Because this kind of refetching is not a highly efficient or optimized methodology, there are significant performance concerns. Consider carefully before using scroll-sensitive result sets as currently implemented. There is also a significant tradeoff between sensitivity and performance. The most sensitive result set is one with a fetch size of 1, which would result in the new current row being refetched every time you move between rows. However, this would have a significant impact on the performance of your application.
    how can i implement this using
    JDBC 2.0 DatabaseMetaData objects include the following methods to verify this. Each takes a result set type as input (ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_SENSITIVE, or ResultSet.TYPE_SCROLL_INSENSITIVE).
    boolean deletesAreDetected(int) throws SQLException
    boolean updatesAreDetected(int) throws SQLException
    boolean insertsAreDetected(int) throws SQLException

  • Help with Sum using FormCalc in Livecycle

    Hello. I'm stuck. I've been doing searches, readings, and all that on how to sum up certain cells in Livecycle. I have tried examples and tutorials and I get stuck when the application says "Error: Accessor ' ' Unknown".
    I'm such a novice in using Livecycle and I'm not a programmer. So, if someone can help me on why it does this, that would be awesome!

    Here you go.  I rename it.  Couple of things.  Too many subforms (unless you intend to do something else with this).  Also, make sure you save your forms as "dynamic" if you intend to have user enter info.  I couldn't tell if you were importing/exporting to a spreadsheet.  Note the formcalc.  Your fields need to be named the same.  In my example they are: ExpCosts.
    I'm not very good with the formcalc/java and variables but am more than willing to help with what I can

  • Help with SUM function ??

    Hi,
    I am trying to build a SUM function into the following SELECT statement;
    SELECT   emp_code "EmployeeCode", trn_date "TransactionDate", project "ProjectCode",
    phase_code "PhaseCode", task_code "TaskCode", reg_hrs "RegularHoursAmt", rate_reg "RegularHoursRate", ot_hrs "OvertimeHoursAmt", rate_ot "OvertimeHoursRate"
    Currently when i do the extract to xls I manually compile the "RegularHoursAmt" and "RegularHoursRate" manually and it's quite a task. I'm sure it can be completed in teh SELECT but I'm not clear on how and it's been quite some time since my last foray into SQL. Any assistance appreciated.
    I need to sum "RegularHoursAmt" and "RegularHoursRate"
    per "EmployeeCode"
    by "TransactionDate"
    with unique combo of "ProjectCode", "PhaseCode", "TaskCode"
    Cheers, Peter

    Hi, Peter,
    PJS5 wrote:
    Thanks Frank for the quick response. Ok, here goes;
    The TABLES already exist and I am only pulling the data for the columns in my SELECT statement so no CREATE of INSERT as such.Post CREATE TABLE and INSERT statements so that the people who want to help you can re-create the problem and test their ideas.
    The data is in Oracle 10g 10.1.0.2.0Perfect!
    So you want totals that represent the entire day for a given employee.
    Yes, but rows are by the unique combo per employee of "ProjectCode", "PhaseCode", "TaskCode"So a row of output will represent a distinct combination of employee, day, ProjectCode, PhaseCode and TaskCode, and that one output row may correspond to more than one row of input; is that right?
    eg Tom works on 4 unique "ProjectCode/PhaseCode/TaskCode" efforts on "TransactionDate"What does "effort" mean here? If I could look at some actaul data (or actual fake data; don't post anything like real credit card numbers) and the results you want from that data, perhaps it would be clear.
    One of those unique "ProjectCode/PhaseCode/TaskCode" efforts however has 3 timesheet entries as he has added unique Descriptions of what his efforts were aimed at achieving.
    We are not extracting the Descriptions and thereby want to SUM those 3 timesheet entries into one row.
    Do you also want a total for each employee, over all days? No thanks
    Do you want a grand total for all employees and all days? No thanks
    Do you want the totals on the same output rows as your current reuslts? That would be handy
    If so, use the analytic SUM function. I'm not familiar with this
    Do you want separate rows for the the totals? That could helpPost the exact results you want from a small set of given data. It's fine to describe the results, as you did above, but describe them in addition to (not instead of) actually showing them.
    Does that make my questions easier to follow?It looks good, but without some sample data and the results you want from that data, I can't say for sure.
    Please post CREATE TABLE and INSERT statements (relevant columns only) for a little sample data, so that I (and the others who want to help you) can see exactly what your tables are like, and actually try our solutions. Simplify as much as possible. For example, if the data is actually coming from a multi-table join, but you already know how to join all the tables perfectly, then pretend all the data is in one table, and post CREATE TABLE and INSERT statements for that one table that looks sort of like your current result set. Post just enough data to show what you want to do. Based on what you've said so far, I'm guessing that 10 to 20 rows of raw data, resulting in 3 to 7 rows of output could give a nice example.
    Also, post the exact results you want from the sample data you post. Explain, with specific examples, how you get those results from that data.
    If parts of your desired output are optional (that is, if some parts "would be handy" or "could help") then post a couple of different sets of results from the same data, and explain, something like this:
    "What I'd really love to get for results is" ...
    but, if that makes things really complicated or inefficient, I don't absolutely need ... or ...,
    so I'd settle for these results: ..."
    I know it's a lot of work to post all this information, but it's really necessary. If I could help you without making you do all this, then I would. Unfortunately, I really don't have a good idea of where you're coming from or where you want to go.
    Edited by: Frank Kulash on Oct 19, 2010 8:01 PM

  • Need help with sum from previous years

    Hi All,
    In a report i have 4 fields. The first field shows the YTD invoice totals for the current FY 2010 (which i accomplished). The other 3 fields are :
    2nd field Sum of the value of invoices for the FY 1YEAR prior to the current year
    3rd field Sum of the value of invoices for the FY 2YEAR's prior to the current year.
    4th field Sum of the value of invoices for the FY 3YEAR's prior to the current year.
    How can i get the desired results for the second,third and the fourth fields, please need help or advice.
    Thanks

    Hi
    If you have the values for several years in the same report you should be able to do what you want using the analytic LEAD and LAG.
    LAG will retrieve values from previous rows whereas LEAD will retrieve values from following rows.
    The basic syntax is the same and look like this:
    LAG(value, offset) OVER ({optional_partition_clause} ORDER BY mandatory_order_clause)
    The ORDER BY clause is mandatory and cannot be omitted. However, this ORDER BY has nothing to do with the sort order you manually create in the worksheet. Generally, most people will set their sort order the same as the ORDER BY in the calculation.
    Here's an example that gets year to date from 2 financial years ago:
    LAG(YTD,2) OVER (ORDER BY FY)
    You have to understand that Discoverer will pull values from previous rows not from previous cells as displayed on the report, although if the cells may happen to be rows too then it will appear as though it is pulling previous cells. I personally am very experienced with analytuc functions and can make manipulate data within Discoverer just about any way that I want. Generally, if I can see data on the screen even when they are in different cells or rows I can create functions to manipulate it. This capability only comes about as a result of experience and I would strongly advise you to practice with the analytics and see if you can at least master some of them. You'll find your Discoverer capabilities will improve dramatically and you will become a great asset at work.
    When working with a new report I generally duplicate the report as a table so that I can see the values. Then if I need to sort the items in order to line up the values I want to work with I do so. Having worked out what sort order I need I can then see what offset I use then I create the analytic and use it in the main worksheet.
    Hope this helps
    Best wishes
    Michael

  • Help with adding rows to JTable

    Could any body help me with the following problem:
    I have created form where I use JTable.Initially I should show 5 rows in JTable. User can enter data into the cells.And commit I should store the data in database.
    My problem is how to dynamically add rows to JTable as user is entering the data. And how to retain the data in the cells when it is entered.
    Right now when user edits a cell and tabs to next one the data in previous cell disappears.
    Its Urgent can anybody help me
    Thanks in advance
    Babu

    The number of rows, number of columns, etc, are all determined by the TableModel used in the JTable.
    What is the easiest solution is to subclass AbstractTableModel adding methods to support your dynamic row adding/deleting/etc that you need. If you go to the javadoc for JTable, there's a link to a tutorial which contains most of what you need to know.
    - David

  • Actuate to BIP Conversion Need Help with Sum and Distinct

    Hi,
    I am in the process of converting an Actuate report to BI Publisher .rtf format. Within the actuate report I have encountered the following code in one of the fields:
    Sum([ssCalc])Distinct([ssProfessional_Id])
    From what I understand this Actuate code is grouping by distinct ssProfessional_Id then taking the sum of the ssCalc field.
    In my .rtf template I have the following:
    <?for-each-group:ssSRA;./ssCIN?>
    <?ssCalc?>
    <?end for-each-group?>
    I need to convert the Actuate code into the place where I currently have <?ssCalc?> in my template but I have no idea how I can translate translate this. Does anyone have any suggestions?????
    Thanks,
    Fred

    Fred
    Can you post the XML, easier to help then
    Tim

  • Help with Front Row...

    I just received my refurbished imac replacement.It is running great,i added more memory up to 2gb. My question is i dont have Front Row on this replacement it is the same as the imac i sent back 20in. 2.16ghz 2gb ram 250gb hd how do i install this do i have to re-install everything?

    acidpope
    Here's everything you'll need to troubleshoot Front Row and your Remote.
    1) Keyboard shortcuts for Front Row
    http://docs.info.apple.com/article.html?path=Mac/10.4/en/cdb_frkybd.html
    2) Troubleshooting the Apple Remote
    http://docs.info.apple.com/article.html?artnum=302549
    3) Pairing your Apple Remote with your computer
    http://docs.info.apple.com/article.html?artnum=302545
    4) How to replace the Apple Remote battery
    http://docs.info.apple.com/article.html?artnum=302543
    Dennis
    17" iMac Intel Core Duo 1.5GB Ram   Mac OS X (10.4.8)   Maxtor 300GB FireWire 2G Nano

  • Help with implementing Row Level Security in Interactive Reporting

    We're deploying Hyperion BI+ 9.3.1, using Workspace and Interactive Reporting. I'm researching how we can use the Workspace row level security option. I've read what's available for documentation in the Workspace Administrator Guide and the Interactive Reporting Users Guide. I understand the concept of setting up rules with row_level_security.bqy, but I'm confused about where these tables should go and what actually happens when I go to Workspace > Administrator > Row Level Security and turn it on.
    The Administrator's Guide tells me the "properties" are stored in the repository, but the "rules" are in the "data source". Does that mean my BRIOSEC* tables go in the database I'm running my reports from? If so, then what's the data source I'm filling in on Workspace > Administrator > Row Level Security?
    I have many different database connections going to different Oracle and SQL*Plus instances, and I don't want to apply row level security to all of them. How does Workspace tell the difference between them? If I enable rules but create a report from a database that doesn't have rules defined for it, what happens?

    The 3 tables used with the RLS are stored in the same schema as your repository by default.
    The RLS store all the Rules for any database that you are using.
    You define the rules based on the tablename (owner.tablename) and the column name.

  • Help with SUM subquery

    I have an existing query that I wish to have 3 additional calculated columns added.
    The existing query is:
    SELECT t.swid as ID,
    t.name,
    t.swcatid,
    t2.catdesc as Category,
    t.liccnt,
    (select count(swid) as swcount from swinv t2 where t2.swid=t.swid) Reccnt,
    t.liccnt-(select count(swid) as swcount from swinv t2 where t2.swid=t.swid) as Avail,
    t.last_update_date as updated
    FROM SOFTWARE t
    LEFT OUTER JOIN swcat t2 ON T.swcatid=t2.swcatid
    order by t.name;
    For the first calculated column, I need the sum of the liccnt where the SWIDs have the same GID in the following table:
    TableName = colic
    Columns: CID (primary key)
    GID
    SWID
    I created a query that sums the liccnt in the Software table grouped by GID -- let's call this result (GroupLic):
    SELECT t3.gid, nvl(Sum(t5.LicCnt),0) AS SumOfLicCnt
    FROM CoLic t3 left outer JOIN Software t5 ON t3.SWID = t5.SWID
    GROUP BY t3.gid;
    The 2nd new calculated column should be the total of COUNTS of SWID in the SWInv where the SWID=the SWIDs in the CoLic table -- let's call this result (InstalledGroupLic):
    TableName=SWInv
    Columns: SID (primary key)
    PCID
    SWID
    Last_Update_Date
    I created a query that displays the counts by GID -- let's call this result (InstalledGroupLic)
    SELECT t4.gid, (select count(t6.SID) AS CountofSWInv from swinv t6 where t6.swid=t4.swid) CollInstalled
    FROM CoLic t4;
    The 3rd Calculated column should be the difference between the SumOfLicCnt in GroupLic and CountofSWInv in InstalledGroupLic (SumOfLicCnt -CountofSWInv).
    The columns should display a 0 if there is no record in the CoLic table with the same SWID in the Software table.
    Any assistance with this would be greatly appreciated.
    Thank you in advance.
    Lillianne

    REM INSERTING into COLIC
    Insert into COLIC (CID,GID,SWID) values (1,1,12);
    Insert into COLIC (CID,GID,SWID) values (2,1,13);
    Insert into COLIC (CID,GID,SWID) values (3,2,20);
    Insert into COLIC (CID,GID,SWID) values (4,2,21);
    Insert into COLIC (CID,GID,SWID) values (5,3,40);
    Insert into COLIC (CID,GID,SWID) values (6,3,41);
    REM INSERTING into SWINV
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (46,2,12,to_timestamp('04-JAN-10 12:05:47 PM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (47,41,12,to_timestamp('04-JAN-10 12:06:34 PM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (48,43,12,to_timestamp('04-JAN-10 12:06:46 PM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (49,49,12,to_timestamp('04-JAN-10 12:07:40 PM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (50,11,12,to_timestamp('04-JAN-10 12:07:50 PM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (55,56,12,to_timestamp('04-JAN-10 12:11:00 PM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (137,80,13,to_timestamp('04-JAN-10 01:18:00 PM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (138,82,13,to_timestamp('04-JAN-10 01:18:28 PM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (139,83,13,to_timestamp('04-JAN-10 01:18:32 PM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (140,85,13,to_timestamp('04-JAN-10 01:18:46 PM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (842,276,20,to_timestamp('05-JAN-10 10:48:00 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (845,275,20,to_timestamp('05-JAN-10 10:48:00 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (848,272,20,to_timestamp('05-JAN-10 10:48:00 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (1229,197,20,to_timestamp('05-JAN-10 10:48:00 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (1232,207,20,to_timestamp('05-JAN-10 10:48:00 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (1235,214,20,to_timestamp('05-JAN-10 10:48:00 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (7,101,40,to_timestamp('31-DEC-09 03:24:43 PM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (336,47,41,to_timestamp('05-JAN-10 10:29:27 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (545,259,41,to_timestamp('05-JAN-10 04:33:30 PM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (372,35,78,to_timestamp('05-JAN-10 10:48:00 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (373,35,152,to_timestamp('05-JAN-10 10:48:00 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (374,36,19,to_timestamp('05-JAN-10 10:48:00 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (855,270,78,to_timestamp('05-JAN-10 10:48:00 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (856,270,152,to_timestamp('05-JAN-10 10:48:00 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (857,269,19,to_timestamp('05-JAN-10 10:48:00 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (859,269,152,to_timestamp('05-JAN-10 10:48:00 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (862,278,78,to_timestamp('05-JAN-10 10:48:00 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (865,273,19,to_timestamp('05-JAN-10 10:48:00 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (885,254,78,to_timestamp('05-JAN-10 10:48:00 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (886,254,152,to_timestamp('05-JAN-10 10:48:00 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (887,250,19,to_timestamp('05-JAN-10 10:48:00 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (771,265,221,to_timestamp('08-JAN-10 05:17:17 PM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (772,250,221,to_timestamp('08-JAN-10 05:17:30 PM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (787,261,225,to_timestamp('08-JAN-10 05:22:22 PM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (788,262,225,to_timestamp('08-JAN-10 05:22:31 PM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (789,145,226,to_timestamp('08-JAN-10 05:22:57 PM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (790,230,226,to_timestamp('08-JAN-10 05:23:08 PM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (791,268,235,to_timestamp('11-JAN-10 09:32:08 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (792,210,240,to_timestamp('11-JAN-10 09:33:16 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (793,163,249,to_timestamp('11-JAN-10 09:34:30 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWINV (SID,PCID,SWID,LAST_UPDATE_DATE) values (794,175,251,to_timestamp('11-JAN-10 09:35:20 AM','DD-MON-RR HH.MI.SSXFF AM'));
    REM INSERTING into SOFTWARE
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (2,'Upgrade Advantage',4,to_timestamp('30-DEC-09 05:59:22 PM','DD-MON-RR HH.MI.SSXFF AM'),80);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (3,'Xp Pro Softwars Assurance Upgrade',4,to_timestamp('30-DEC-09 05:59:34 PM','DD-MON-RR HH.MI.SSXFF AM'),152);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (4,'Windows 95',1,to_timestamp('30-DEC-09 05:59:52 PM','DD-MON-RR HH.MI.SSXFF AM'),78);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (5,'Windows 98',1,to_timestamp('30-DEC-09 06:00:06 PM','DD-MON-RR HH.MI.SSXFF AM'),22);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (6,'Windows Me',1,to_timestamp('30-DEC-09 06:00:17 PM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (7,'Windows 2003 Server',1,to_timestamp('30-DEC-09 06:00:27 PM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (8,'Windows 2003 Server R2',1,to_timestamp('30-DEC-09 06:00:35 PM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (9,'Windows 2003 Server R2 W/Software Assurance',1,to_timestamp('30-DEC-09 06:00:44 PM','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (10,'Windows 2000 Oem (Tracking Only)',1,to_timestamp('30-DEC-09 06:00:53 PM','DD-MON-RR HH.MI.SSXFF AM'),8);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (11,'Windows Nt 4.0 Workstation',1,to_timestamp('30-DEC-09 06:01:06 PM','DD-MON-RR HH.MI.SSXFF AM'),64);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (12,'Windows 2000 Professional',1,to_timestamp('30-DEC-09 06:01:15 PM','DD-MON-RR HH.MI.SSXFF AM'),83);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (13,'Windows Xp Professional',1,to_timestamp('30-DEC-09 06:01:24 PM','DD-MON-RR HH.MI.SSXFF AM'),245);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (14,'Vista Ultimate',1,to_timestamp('30-DEC-09 06:01:33 PM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (15,'Vista Business',1,to_timestamp('30-DEC-09 06:01:42 PM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (16,'Windows Nt 4.0 Server',1,to_timestamp('31-DEC-09 10:47:06 AM','DD-MON-RR HH.MI.SSXFF AM'),9);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (17,'Software Assure Nt4 Server To W2k Server',1,to_timestamp('31-DEC-09 10:47:43 AM','DD-MON-RR HH.MI.SSXFF AM'),9);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (18,'Cal For Windows Nt 4.0 Server',1,to_timestamp('31-DEC-09 10:47:56 AM','DD-MON-RR HH.MI.SSXFF AM'),50);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (19,'Cal For Windows 2000 Server',1,to_timestamp('31-DEC-09 10:48:03 AM','DD-MON-RR HH.MI.SSXFF AM'),245);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (20,'Cal For Windows 2003 Server',1,to_timestamp('31-DEC-09 10:48:11 AM','DD-MON-RR HH.MI.SSXFF AM'),345);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (21,'Cal For Windows 2008 Server',1,to_timestamp('31-DEC-09 10:48:21 AM','DD-MON-RR HH.MI.SSXFF AM'),30);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (22,'Cal For Microsoft Sql Server 2000',1,to_timestamp('31-DEC-09 10:48:28 AM','DD-MON-RR HH.MI.SSXFF AM'),5);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (23,'Windows 2000 Server',1,to_timestamp('31-DEC-09 10:48:36 AM','DD-MON-RR HH.MI.SSXFF AM'),4);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (24,'Microsoft Sql Server 2000',1,to_timestamp('31-DEC-09 10:48:52 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (25,'Fedora Core3',1,to_timestamp('31-DEC-09 10:48:58 AM','DD-MON-RR HH.MI.SSXFF AM'),4);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (26,'Redhat',1,to_timestamp('31-DEC-09 10:49:05 AM','DD-MON-RR HH.MI.SSXFF AM'),9);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (27,'Redhat Enterprise Server',1,to_timestamp('31-DEC-09 10:49:12 AM','DD-MON-RR HH.MI.SSXFF AM'),2);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (28,'Mac Os X 10.1.3',1,to_timestamp('31-DEC-09 10:49:19 AM','DD-MON-RR HH.MI.SSXFF AM'),5);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (29,'Mac Os X 10.1.4',1,to_timestamp('31-DEC-09 10:49:26 AM','DD-MON-RR HH.MI.SSXFF AM'),5);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (30,'Act! 3.0',4,to_timestamp('31-DEC-09 05:02:17 PM','DD-MON-RR HH.MI.SSXFF AM'),2);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (31,'Activeperl 521',4,to_timestamp('31-DEC-09 10:49:51 AM','DD-MON-RR HH.MI.SSXFF AM'),0);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (32,'Adaptec Easy Cd Creator 4',4,to_timestamp('31-DEC-09 10:49:56 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (33,'Adobe Acrobat 4.0 Full Version',2,to_timestamp('31-DEC-09 05:03:01 PM','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (34,'Adobe Acrobat 5.0 Upgrade',2,to_timestamp('31-DEC-09 10:51:41 AM','DD-MON-RR HH.MI.SSXFF AM'),2);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (35,'Adobe Acrobat 6.0 Professional Upgrade',2,to_timestamp('31-DEC-09 10:51:47 AM','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (36,'Adobe Acrobat 6.0 Professional',2,to_timestamp('31-DEC-09 10:51:52 AM','DD-MON-RR HH.MI.SSXFF AM'),4);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (37,'Adobe Acrobat 7.0 Professional Upgrade',2,to_timestamp('31-DEC-09 10:51:57 AM','DD-MON-RR HH.MI.SSXFF AM'),5);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (38,'Adobe Acrobat 7.0 Professional Full Version',2,to_timestamp('31-DEC-09 10:52:02 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (39,'Adobe Acrobat 6.0 Upgrade',2,to_timestamp('31-DEC-09 10:52:07 AM','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (40,'Adobe Acrobat 5.0 Standard Full Version',2,to_timestamp('31-DEC-09 10:52:12 AM','DD-MON-RR HH.MI.SSXFF AM'),2);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (41,'Adobe Acrobat 6.0 Standard Full Version',2,to_timestamp('31-DEC-09 10:52:18 AM','DD-MON-RR HH.MI.SSXFF AM'),7);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (42,'Adobe Acrobat 7.0 Standard Full Version',2,to_timestamp('31-DEC-09 10:52:23 AM','DD-MON-RR HH.MI.SSXFF AM'),4);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (43,'Adobe Acrobat 8.0 Standard Full Version',2,to_timestamp('31-DEC-09 10:52:27 AM','DD-MON-RR HH.MI.SSXFF AM'),9);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (44,'Adobe After Effects 5.5',2,to_timestamp('31-DEC-09 10:52:32 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (45,'Adobe Creative Suite 3 Web Upgrade (Dreamweaver 8 Mike B)',2,to_timestamp('31-DEC-09 10:52:37 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (46,'Adobe Framemaker 5.5',2,to_timestamp('31-DEC-09 10:52:43 AM','DD-MON-RR HH.MI.SSXFF AM'),2);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (47,'Adobe Framemaker V6.0',2,to_timestamp('31-DEC-09 10:52:53 AM','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (48,'Adobe Framemaker 7.0 Upgrade',2,to_timestamp('31-DEC-09 10:52:59 AM','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (49,'Adobe Framemaker 7.0 Full',2,to_timestamp('31-DEC-09 10:53:04 AM','DD-MON-RR HH.MI.SSXFF AM'),0);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (50,'Adobe Framemaker 7.1 Full',2,to_timestamp('31-DEC-09 10:53:09 AM','DD-MON-RR HH.MI.SSXFF AM'),0);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (51,'Adobe Framemaker 7.2 Upgrade',2,to_timestamp('31-DEC-09 10:53:14 AM','DD-MON-RR HH.MI.SSXFF AM'),6);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (52,'Adobe Framemaker 7.2 Full',2,to_timestamp('31-DEC-09 10:53:20 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (53,'Framemaker Archive Plugin',2,to_timestamp('31-DEC-09 10:53:27 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (54,'Framemaker Findchange Plugin',2,to_timestamp('31-DEC-09 10:53:31 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (55,'Framemaker Cleanimport Plugin',2,to_timestamp('31-DEC-09 10:53:36 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (56,'Framemaker Pagelabeler Plugin',2,to_timestamp('31-DEC-09 10:53:40 AM','DD-MON-RR HH.MI.SSXFF AM'),5);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (57,'Framemaker Impgraph Plugin',2,to_timestamp('31-DEC-09 10:53:44 AM','DD-MON-RR HH.MI.SSXFF AM'),6);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (58,'Adobe Illustrator 10',2,to_timestamp('31-DEC-09 10:53:50 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (59,'Adobe Indesign',2,to_timestamp('31-DEC-09 10:53:55 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (60,'Adobe Pagemaker 6.5',2,to_timestamp('31-DEC-09 10:54:12 AM','DD-MON-RR HH.MI.SSXFF AM'),2);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (61,'Adobe Photodeluxe Business Edition 1.0',2,to_timestamp('31-DEC-09 10:54:17 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (99,'Corel Essentials',4,to_timestamp('31-DEC-09 10:59:46 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (100,'Cupl For Windows 4.9A',4,to_timestamp('31-DEC-09 10:59:54 AM','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (101,'Crystal Reports 8',4,to_timestamp('31-DEC-09 10:59:58 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (102,'Crystal Reports 9',4,to_timestamp('31-DEC-09 11:00:03 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (103,'Crystal Reports 11',4,to_timestamp('31-DEC-09 11:00:08 AM','DD-MON-RR HH.MI.SSXFF AM'),2);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (104,'Data Desk 6.0',4,to_timestamp('31-DEC-09 11:00:14 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (105,'Datapaq Reflow Tracker With Insight Software',4,to_timestamp('31-DEC-09 11:00:23 AM','DD-MON-RR HH.MI.SSXFF AM'),5);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (106,'Descriptions Now',4,to_timestamp('31-DEC-09 11:00:28 AM','DD-MON-RR HH.MI.SSXFF AM'),2);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (107,'Designcad 97',4,to_timestamp('31-DEC-09 11:00:36 AM','DD-MON-RR HH.MI.SSXFF AM'),0);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (108,'Designcad Express',4,to_timestamp('31-DEC-09 11:00:41 AM','DD-MON-RR HH.MI.SSXFF AM'),2);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (109,'Designcad 3D Max 14',4,to_timestamp('31-DEC-09 11:00:46 AM','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (110,'Designcad Express 15',4,to_timestamp('31-DEC-09 11:00:52 AM','DD-MON-RR HH.MI.SSXFF AM'),2);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (111,'Desktop To Go',4,to_timestamp('31-DEC-09 11:00:58 AM','DD-MON-RR HH.MI.SSXFF AM'),22);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (112,'Dream Weaver Mx',4,to_timestamp('31-DEC-09 11:01:04 AM','DD-MON-RR HH.MI.SSXFF AM'),4);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (113,'Dream Weaver Mx 8 Upgrade',4,to_timestamp('31-DEC-09 11:01:12 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (114,'Dream Weaver Mx 8 ',4,to_timestamp('31-DEC-09 11:01:17 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (115,'Dream Weaver 9 Upgrade (Cs3) ',4,to_timestamp('31-DEC-09 11:01:23 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (116,'Dream Weaver Studio Mx',4,to_timestamp('31-DEC-09 11:01:30 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (117,'Dream Weaver Cs3',4,to_timestamp('31-DEC-09 11:01:36 AM','DD-MON-RR HH.MI.SSXFF AM'),2);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (118,'Dream Weaver Cs4',4,to_timestamp('31-DEC-09 11:01:40 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (119,'Dream Weaver Mx For Mac',4,to_timestamp('31-DEC-09 11:01:45 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (120,'Dxf Reader ',4,to_timestamp('31-DEC-09 11:01:51 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (121,'Editplus 2',4,to_timestamp('31-DEC-09 11:01:56 AM','DD-MON-RR HH.MI.SSXFF AM'),0);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (122,'Ericom Powerterm 5.4',4,to_timestamp('31-DEC-09 11:02:01 AM','DD-MON-RR HH.MI.SSXFF AM'),61);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (123,'Final Cut Studio 5.1 (Mac) ',4,to_timestamp('31-DEC-09 11:02:07 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (124,'Final Cut Studio 6.0 Upgrade (Mac)',4,to_timestamp('31-DEC-09 11:02:12 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (125,'Filemaker Pro 5.5',4,to_timestamp('31-DEC-09 11:02:17 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (126,'Forticlient',4,to_timestamp('31-DEC-09 11:02:22 AM','DD-MON-RR HH.MI.SSXFF AM'),6);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (127,'Gagetrak Se',4,to_timestamp('31-DEC-09 11:02:28 AM','DD-MON-RR HH.MI.SSXFF AM'),2);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (128,'Gibbscam V7.3.5',4,to_timestamp('31-DEC-09 11:02:34 AM','DD-MON-RR HH.MI.SSXFF AM'),2);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (129,'Gibbscam 2006 V8.0.19',4,to_timestamp('31-DEC-09 11:02:44 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (130,'Hypersnap-Dx',4,to_timestamp('31-DEC-09 11:02:50 AM','DD-MON-RR HH.MI.SSXFF AM'),5);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (131,'Id Automation Code 128 Font',4,to_timestamp('31-DEC-09 11:02:55 AM','DD-MON-RR HH.MI.SSXFF AM'),6);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (132,'Infralution License System',4,to_timestamp('31-DEC-09 11:03:01 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (133,'Installshield Express 2.11',4,to_timestamp('31-DEC-09 11:03:06 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (134,'Intergraph Smartsketch Le',4,to_timestamp('31-DEC-09 11:03:10 AM','DD-MON-RR HH.MI.SSXFF AM'),10);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (135,'Internet Launcher',4,to_timestamp('31-DEC-09 11:03:15 AM','DD-MON-RR HH.MI.SSXFF AM'),0);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (136,'Ipswitch Ws_Ftp Pro',4,to_timestamp('31-DEC-09 11:03:19 AM','DD-MON-RR HH.MI.SSXFF AM'),0);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (137,'Irfan Viewer',4,to_timestamp('31-DEC-09 11:03:24 AM','DD-MON-RR HH.MI.SSXFF AM'),13);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (138,'Ise Project Importer',4,to_timestamp('31-DEC-09 11:03:30 AM','DD-MON-RR HH.MI.SSXFF AM'),0);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (139,'Isopro',4,to_timestamp('31-DEC-09 11:03:34 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (140,'Jandel Scientific Sigmasuite',4,to_timestamp('31-DEC-09 11:03:39 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (141,'Lean Manufacturing',4,to_timestamp('31-DEC-09 11:03:44 AM','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (142,'Lemmy',4,to_timestamp('31-DEC-09 11:03:50 AM','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (143,'Lingobit Localizer 4.5',4,to_timestamp('31-DEC-09 11:03:55 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (144,'Lview Pro 2.0',4,to_timestamp('31-DEC-09 11:04:01 AM','DD-MON-RR HH.MI.SSXFF AM'),6);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (145,'Mathcad 2000',4,to_timestamp('31-DEC-09 11:04:05 AM','DD-MON-RR HH.MI.SSXFF AM'),9);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (146,'Max+Plus Ii 10.0',4,to_timestamp('31-DEC-09 11:04:10 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (147,'Matlab',4,to_timestamp('31-DEC-09 11:04:15 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (148,'Mcafee Virusscan 7.0 Home Use',4,to_timestamp('31-DEC-09 11:04:19 AM','DD-MON-RR HH.MI.SSXFF AM'),99);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (149,'Mediastudio Pro 7',4,to_timestamp('31-DEC-09 11:04:24 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (150,'Microsoft Office 97 Small Business Edition',3,to_timestamp('31-DEC-09 11:04:54 AM','DD-MON-RR HH.MI.SSXFF AM'),5);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (151,'Microsoft Office 97 Standard',3,to_timestamp('31-DEC-09 11:05:00 AM','DD-MON-RR HH.MI.SSXFF AM'),6);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (152,'Microsoft Office 2000 Standard',3,to_timestamp('31-DEC-09 11:05:44 AM','DD-MON-RR HH.MI.SSXFF AM'),30);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (153,'Microsoft Office Xp Standard',3,to_timestamp('31-DEC-09 11:05:50 AM','DD-MON-RR HH.MI.SSXFF AM'),127);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (154,'Microsoft Office 2003 Standard',3,to_timestamp('31-DEC-09 11:05:54 AM','DD-MON-RR HH.MI.SSXFF AM'),11);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (155,'Microsoft Office 2007 Standard',3,to_timestamp('31-DEC-09 11:06:06 AM','DD-MON-RR HH.MI.SSXFF AM'),56);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (156,'Microsoft Office 2000 Sbe (No Powerpoint)',3,to_timestamp('31-DEC-09 11:06:11 AM','DD-MON-RR HH.MI.SSXFF AM'),26);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (157,'Microsoft Access 2000 (Stand Alone)',3,to_timestamp('31-DEC-09 11:06:16 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (158,'Microsoft Access 2003 (Stand Alone)',3,to_timestamp('31-DEC-09 11:06:21 AM','DD-MON-RR HH.MI.SSXFF AM'),26);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (159,'Microsoft Office Professional & Bookshelf',3,to_timestamp('31-DEC-09 11:06:25 AM','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (243,'Test Complete',4,to_timestamp('31-DEC-09 11:16:22 AM','DD-MON-RR HH.MI.SSXFF AM'),2);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (244,'True Dbgrid Pro 8.0',4,to_timestamp('31-DEC-09 11:16:26 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (245,'T Value 4.0',4,to_timestamp('31-DEC-09 11:16:32 AM','DD-MON-RR HH.MI.SSXFF AM'),3);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (246,'Ulead Gif Animator',4,to_timestamp('31-DEC-09 11:16:38 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (247,'Virtual Pc For Mac & 1 Xp Pro License',4,to_timestamp('31-DEC-09 11:16:44 AM','DD-MON-RR HH.MI.SSXFF AM'),4);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (248,'Visio 4.0 For Windows',4,to_timestamp('31-DEC-09 11:16:54 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (249,'Visual Dialogscript',4,to_timestamp('31-DEC-09 11:17:01 AM','DD-MON-RR HH.MI.SSXFF AM'),5);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (250,'Visual Dialogscriptpro',4,to_timestamp('31-DEC-09 11:17:07 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (251,'Winwedge 3.0C',4,to_timestamp('31-DEC-09 11:17:14 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    Insert into SOFTWARE (SWID,NAME,SWCATID,LAST_UPDATE_DATE,LICCNT) values (252,'Xtools',4,to_timestamp('31-DEC-09 11:17:22 AM','DD-MON-RR HH.MI.SSXFF AM'),1);
    REM INSERTING into SWCAT
    Insert into SWCAT (SWCATID,CATDESC,LAST_UPDATE_DATE) values (1,'OPERATING SYSTEM',to_timestamp('30-DEC-09 02:51:00 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWCAT (SWCATID,CATDESC,LAST_UPDATE_DATE) values (2,'ADOBE SOFTWARE',to_timestamp('30-DEC-09 02:57:00 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWCAT (SWCATID,CATDESC,LAST_UPDATE_DATE) values (3,'MICROSOFT SOFTWARE',to_timestamp('30-DEC-09 02:57:00 AM','DD-MON-RR HH.MI.SSXFF AM'));
    Insert into SWCAT (SWCATID,CATDESC,LAST_UPDATE_DATE) values (4,'NONE',to_timestamp('30-DEC-09 02:57:00 AM','DD-MON-RR HH.MI.SSXFF AM'));

  • Need help with merging rows

    Howdy all,
    Given the following data set...
    ID   GROUP_ID   AWESOME   MOD_DATE    LAST_NAME        FIRST_NAME
    52   98              1              2/1/2011       Kirk                    James
    60   99              1              2/2/2011       Kirk                    James
    42   45              0              1/29/2011     Kirk                    James
    100  31             1             6/24/2011      Smurf                 Papa
    200  32             1             6/23/2011      Smurf                 Papa
    300  33             0             6/22/2011      Smurf                 Papa
    400  34             0             6/21/2011     Smurf                  Papa for those with the same last_name and first_name,
    where AWEAOME=0,
    I want to overwrite their GROUP_ID with the grou_ID where AWESOME=1
    and the latest DOM_DATE.
    So for James Kirk, his group_id of 45 will be set the 99
    and for Papa Smurf, his group_ids of 33 and 34 will be set to group_id 31
    Desired result
    ID   GROUP_ID   AWESOME   MOD_DATE    LAST_NAME   FIRST_NAME
    52   98             1              2/1/2011         Kirk              James
    60   99             1              2/2/2011        Kirk              James
    42   99             0             1/29/2011       Kirk              James
    100  31            1             6/24/2011       Smurf             Papa
    200  32            1             6/23/2011      Smurf             Papa
    300  31            0             6/22/2011      Smurf             Papa
    400  31            0             6/21/2011      Smurf             Papa thanks

    Something like
    UPDATE table_name dest
       SET group_id =
        (SELECT group_id
           FROM (
            SELECT group_id,
                   mod_date,
                   first_name,
                   last_name,
                   max( mod_date ) over (partition by last_name, first_name) last_mod_date
               FROM table_name src_inner
              WHERE src_inner.awesome = 1 ) src_outer
          WHERE src_outer.last_mod_date = src_outer.mod_date
            AND src_outer.first_name = dest.first_name
            AND src_outer.last_name = dest.last_name )
    WHERE awesome = 0;should work. This assumes that there is always at least 1 row where AWESOME=1 and the name matches for every row where AWESOME=0. And it assumes there are no duplicates where the same name with AWESOME=1 have the same maximum MOD_DATE.
    Justin

  • Need help with summing column when using if-then-else

    Using logic
    <?xdofx:if INVOICE_BILL_AMT_IN_INV_CURR is null then INVPROC_BILL_AMOUNT else INVOICE_BILL_AMT_IN_INV_CURR end if?> for column field.
    Having trouble summing the column using the logic above.
    Any suggestions would be very much appreciated.
    Thanks,
    Nancy

    Thanks Tim,
    That worked. Got rid of my error. However, if the field is null (=''), I get a total.
    11.05 + 1429.70 = 1440.75
    If the not null (!='') I am not getting a total.
    103.74 + 173.13 =
    BTW, recently took XML class. Leta Davis highly recommended your blog and I have gotten a lot of great tips from it.
    Thanks,
    Nancy

  • Need help with inserting rows in resultset

    hello!
    i want to insert a row in my result set and i want that my table shows this row promptly after i have inserted it in my result set...
    but when i use following code for my resultset:
    rs.moveToInsertRow();
    rs.updateInt(1,nr);
    rs.updateString(2, name);
    rs.insertRow();
    and call fireTableDataChanged afterwards -> nothing happens, rows are inserted in resultset but not shown in my table??
    anyone a clue??

    rs.moveToInsertRow(); // moves cursor to the insert row
    rs.updateString(1, "AINSWORTH"); // updates the
    // first column of the insert row to be AINSWORTH
    rs.updateInt(2,35); // updates the second column to be 35
    rs.updateBoolean(3, true); // updates the third row to true
    rs.insertRow();
    rs.moveToCurrentRow();
    This is from the JAVA API. Something makes me think you might want to try doing the last method execution.
    rs.moveToCurrentRow();
    Vijay

  • Help! Trying to Sum Quantity with Duplicate Rows

    I have a database that have the following columns barcode, quantity, etc. The barcode colum has barcode duplicates and the corresponding quantity differs. I have been working hours trying to solve how to sum each different barcode and replace the table with 1 barcode each with corresponding total quantity. So, instead of:
    97138644756
    3
    97138644756
    2
    97138644756
    1
    97138660565
    5
    97138660565
    4
    97138661777
    1
    97138662224
    1
    97138670403
    1
    97138679239
    1
    97138714978
    1
    97138716262
    1
    97138739667
    6
    97138739667
    7
    97138739667
    8
    I would like it to read:
    97138644756
    6
    97138660565
    9
    97138661777
    1
    97138662224
    1
    97138670403
    1
    97138679239
    1
    97138714978
    1
    97138716262
    1
    97138739667
    21
    I was using the following code, which only picks out the duplicates.
    <cfquery name="CountBarcodesCart1" datasource='inventory'>
    SELECT *
    FROM cart1
    WHERE barcode IN (
    SELECT barcode
    FROM cart1
    GROUP BY barcode 
    HAVING (COUNT(barcode ) > 1))
    </cfquery>
    Thanks for anyone that can help with my business.

    I know there is a lot better way to do this, but I will share the following code and hope it will help someone else. What I did was change from CART1 table to a TEMP table, get the dupliates added up and then output the corrected data (with no duplicates) to a new table. Then, I delete the TEMP table.
    <!--- FIND DUPLICATES AND SUM QUANTITY --->
    <cfquery name="CountBarcodesTemp" datasource='inventory'>
    SELECT barcode, sum(quantity) as quantitysum
    FROM temp 
    GROUP BY barcode
    </cfquery>
    <!--- OUTPUT RESULTS AND INSERT INTO NEW TABLE--->
    <cfoutput query="CountBarcodesTemp">
            <cfquery name="InsertIntoCart" datasource="inventory">
      INSERT INTO Cart1 (barcode, quantity)
      VALUES (#CountBarcodesTemp.barcode#, #CountBarcodesTemp.quantitysum#)
      </cfquery>
    #barcode# -- #QuantitySum#<br /><br/>
    </cfoutput>
    <!---         DELETE THE TEMP TABLE  --->
    <cfquery name="DeleteBarcodesTemp" datasource='inventory'>
    DELETE *
    FROM Temp
    </cfquery>

Maybe you are looking for

  • CTe Entrada em massa

    Boa tarde. Estamos implementando ECC e usando a solução disponibilizada pela SAP de trabalhar com o CTe como um mestre de serviço. As notas foram aplicadas e tudo esta funcionando (Contabilização da Folha/MIRO e escrituração), porém é preciso registr

  • What's the use of description of a bookmark? Find Bookmark in Bookmark-Tree? FavIcons on second synced devide?

    1. I'm a little bit confused about the useage of descriptions of a bookmark. For what can I use it after I filled something in? Is the intention to open the booksmark property to see what I have filled in a long time ago? Maybe I could be useful to a

  • Zen Vision M Problem, help please A

    Just got a Zen vision M, and its really pissing me off. I installed all the software, and plugged it into the computer. The blue light started flashing, and has been for the past 3-4 hours. I then tried plugging it into a wall adapter i have that has

  • Patch Selection Lists?

    Can anyone assist me in figuring out how to set up the environments in the new Logic to be able to select patches from select lists? I would appreciate any help or advice anyone could provide. Thanks, -BigShiid

  • Double-byte support in Captive 5

    I am currently creating multiple choice exams in Captivate 5 (CP5) and here is my problem.  When I paste in the translated text (localized into Chinese-Simplified) from either MS-Word, Excel or Notepad into the question and answer fields in the CP5 Q