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'));

Similar Messages

  • 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

  • Help with a subquery

    Hi all,
    I'm having nightmares with a query I just cant think. I hope some one can help me with this.
    There are 4 tables
    customers ->Cust_id (PK), cust_name, cust_lname, ...
    Invoice -> Invoice_number (PK), cust_id (FK), invoice_date
    Invoice_line -> Invoice_number(FK), (FK)Prod_code, line_price, line_units
    Product -> Prod_code,.....etc
    And I need to make a query that show me the customer name that spent more money.
    The money is obtained as (line_price * line_units), but there are several Invoice_line rows in each Invoice
    So Ive done this so far but I don't know how to extract the max value and linked it to the customer name so I can just show the customer name (cust_fname) and last name (cust_lname).
    select i.cust_id, sum(line_price*line_units)
    from Invoice_Line il join invoice i
    on il.invoice_number=i.Invoice_Number
    group by i.Cust_Id;

    Hi,
    Welcome to the forum!
    So you can get the total amount for every customer, but now you need to narrow that down to just the top-spending customer.
    One way is to number each customer according to how much they spent, then show only #1:
    WITH     got_cust_amt     AS
         select        i.cust_id
         ,       sum (line_price * line_units)     AS cust_amt
         ,       RANK () OVER (ORDER BY  sum (line_price * line_units))
                                  AS r_num
         from       Invoice_Line     il
         join       invoice      i  on      il.invoice_number  = i.Invoice_Number
         group by  i.Cust_Id
    SELECT     c.cust_id
    ,     c.cust_name
    ,     c.cust_lname
    ,     a.cust_amt
    FROM     customers     c
    JOIN     got_gust_amt     a  ON     c.cust_id     = a.cust_id
    WHERE     a.r_num     = 1
    ;I like the method above, because it can easily be modified in case you need the top 5 customers, or the highest spender each year. In the event of a tie, it shows all the customers who have a claim to being the highest spender.
    Here's another variation on the same idea:
    WITH     got_cust_amt     AS
         select        i.cust_id
         ,       sum (line_price * line_units)     AS cust_amt
         from       Invoice_Line     il
         join       invoice      i  on      il.invoice_number  = i.Invoice_Number
         group by  i.Cust_Id
    SELECT     c.cust_id
    ,     c.cust_name
    ,     c.cust_lname
    ,     a.cust_amt
    FROM     customers     c
    JOIN     got_cust_amt     a  ON     c.cust_id     = a.cust_id
    WHERE     c.cust_amt = (
                   SELECT  MAX (cust_amt)
                   FROM     got_cust_amt
    ;This 2nd way can't be easily modified to show the top 5.
    Notice that the sub-query, got_cust_amt, is just what you wrote already (plus another column, in the first version).
    Edited by: Frank Kulash on Nov 10, 2010 10:54 AM
    Corrected mis-spelling.

  • 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

  • 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 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!!

  • 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

  • Help with sql subquery/grouping

    Hi... having trouble getting this query to work. Here's the table and data:
    create table mytable (
    rec_num number,
    status_num number,
    status_date date
    insert into mytable values (1,1,'01-AUG-2006');
    insert into mytable values (1,2,'14-AUG-2006');
    insert into mytable values (1,8,'01-SEP-2006');
    insert into mytable values (1,3,'15-SEP-2006');
    insert into mytable values (1,2,'03-SEP-2006');
    insert into mytable values (2,2,'17-AUG-2006');
    insert into mytable values (3,2,'02-SEP-2006');
    insert into mytable values (3,4,'07-SEP-2006');
    insert into mytable values (4,1,'18-SEP-2006');
    insert into mytable values (4,4,'27-SEP-2006');
    insert into mytable values (4,2,'18-SEP-2006');
    insert into mytable values (5,1,'01-OCT-2006');
    insert into mytable values (5,2,'03-OCT-2006');
    insert into mytable values (5,3,'05-OCT-2006');
    insert into mytable values (6,1,'01-OCT-2006');
    insert into mytable values (7,2,'14-OCT-2006');
    insert into mytable values (7,8,'15-OCT-2006');
    I'm trying to select the rec_num, status_num, and status_date for the max date for each individual rec_num... it basically tells me the current status of each individual record by getting the status for the most recent date... like the following:
    rec_num, status_num, date
    1, 3, 15-SEP-2006
    2, 2, 17-AUG-2006
    3, 4, 07-SEP-2006
    etc
    This query works... it gets me the max date for each record... but it doesn't give me the status_num:
    select rec_num, max(status_date)
    from mytable
    group by rec_num
    Adding status_num messes it up... I know I need some kindof sub-query, but haven't been able to get one to work.
    I'd also like a query to get a count on how many records currently exist in each status.
    Can someone help me out? Oracle 8i. Thanks!

    SQL> select * from my_table;
       REC_NUM STATUS_NUM STATUS_DA
             1          1 01-AUG-06
             1          2 14-AUG-06
             1          8 01-SEP-06
             1          3 15-SEP-06
             1          2 03-SEP-06
             2          2 17-AUG-06
             3          2 02-SEP-06
             3          4 07-SEP-06
             4          1 18-SEP-06
             4          4 27-SEP-06
             4          2 18-SEP-06
             5          1 01-OCT-06
             5          2 03-OCT-06
             5          3 05-OCT-06
             6          1 01-OCT-06
             7          2 14-OCT-06
             7          8 15-OCT-06
    SQL> select mt.rec_num,
      2         mt.status_num,
      3         mt.status_date
      4    from (select row_number() over (partition by rec_num order by status_date desc) rn,
      5                 rec_num,
      6                 status_num,
      7                 status_date
      8            from my_table) mt
      9   where mt.rn = 1;
       REC_NUM STATUS_NUM STATUS_DA
             1          3 15-SEP-06
             2          2 17-AUG-06
             3          4 07-SEP-06
             4          4 27-SEP-06
             5          3 05-OCT-06
             6          1 01-OCT-06
             7          8 15-OCT-06
    7 rows selected.
    SQL>

  • Help with count and sum query

    Hi I am using oracle 10g. Trying to aggregate duplicate count records. I have so far:
    SELECT 'ST' LEDGER,
    CASE
    WHEN c.Category = 'E' THEN 'Headcount Exempt'
    ELSE 'Headcount Non-Exempt'
    END
    ACCOUNTS,
    CASE WHEN a.COMPANY = 'ZEE' THEN 'OH' ELSE 'NA' END MARKET,
    'MARCH_12' AS PERIOD,
    COUNT (a.empl_id) head_count
    FROM essbase.employee_pubinfo a
    LEFT OUTER JOIN MMS_DIST_COPY b
    ON a.cost_ctr = TRIM (b.bu)
    INNER JOIN MMS_GL_PAY_GROUPS c
    ON a.pay_group = c.group_code
    WHERE a.employee_status IN ('A', 'L', 'P', 'S')
    AND FISCAL_YEAR = '2012'
    AND FISCAL_MONTH = 'MARCH'
    GROUP BY a.company,
    b.district,
    a.cost_ctr,
    c.category,
    a.fiscal_month,
    a.fiscal_year;
    which gives me same rows with different head_counts. I am trying to combine the same rows as a total (one record). Do I use a subquery?

    Hi,
    Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved.
    Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
    user610131 wrote:
    ... which gives me same rows with different head_counts.If they have different head_counts, then the rows are not the same.
    I am trying to combine the same rows as a total (one record). Do I use a subquery?Maybe. It's more likely that you need a different GROUP BY clause, since the GROUP BY clause determines how many rows of output there will be. I'll be able to say more after you post the sample data, results, and explanation.
    You may want both a sub-query and a different GROUP BY clause. For example:
    WITH    got_group_by_columns     AS
         SELECT  a.empl_id
         ,     CASE
                        WHEN  c.category = 'E'
                  THEN  'Headcount Exempt'
                        ELSE  'Headcount Non-Exempt'
                END          AS accounts
         ,       CASE
                        WHEN a.company = 'ZEE'
                        THEN 'OH'
                        ELSE 'NA'
                END          AS market
         FROM              essbase.employee_pubinfo a
         LEFT OUTER JOIN  mms_dist_copy             b  ON   a.cost_ctr     = TRIM (b.bu)
         INNER JOIN       mms_gl_pay_groups        c  ON   a.pay_group      = c.group_code
         WHERE     a.employee_status     IN ('A', 'L', 'P', 'S')
         AND        fiscal_year           = '2012'
         AND        fiscal_month          = 'MARCH'
    SELECT    'ST'               AS ledger
    ,       accounts
    ,       market
    ,       'MARCH_12'          AS period
    ,       COUNT (empl_id)       AS head_count
    FROM       got_group_by_columns
    GROUP BY  accounts
    ,            market
    ;But that's just a wild guess.
    You said you wanted "Help with count and sum". I see the COUNT, but what do you want with SUM? No doubt this will be clearer after you post the sample data and results.
    Edited by: Frank Kulash on Apr 4, 2012 5:31 PM

  • Subquery results need help with output

    Requirements:
    There is request to dump every day’s data from one table into text file.
    Tables:INSPECTION_RESULTS
    NJAS
    Primary Key: RES_SYS_NO
    Parent table: INSPECTION_RESULTS
    Child table: NJAS
    Purpose:
    1. obtain output results for the MIN and MAX RES_SYS_NO from INSPECTION_RESULTS table for yesterday’s date.
    2. Create comma delimited file for following columns using above table data output.
    Script thus far:
    SELECT NJA_RES_SYS_NO||','||NJA_TEST_REC_NO||','||NJA_LIC_ST_ID||','||NJA_ETS_ID||','||NJA_SW_VER||','||NJA_TECH_ID||','||NJA_VIN||','||NJA_LIC_NO||','
    ||NJA_LIC_JUR||','||NJA_LIC_SRC||','||NJA_MODEL_YR||','||NJA_MAKE||','||NJA_MODEL||','||NJA_VHCL_TYPE||','||NJA_BODY_STYLE||','||NJA_CERT_CLASS||','||
    NJA_GVWR||','||NJA_ASM_ETW||','||NJA_ETW_SRC||','||NJA_NO_OF_CYL||','||NJA_ENG_SIZE||','||NJA_TRANS_TYPE||','||NJA_DUAL_EXH||','||NJA_FUEL_CD||','
    || NJA_VID_SYS_NO||','|| NJA_VRT_REC_NO||','|| NJA_ARMSTDS_REC_NO||','|| NJA_RSN_F_N_TESTABLE||','|| NJA_DYNO_TESTABLE||','||
    NJA_CURR_ODO_RDNG||','|| NJA_PREV_ODO_RDNG||','|| NJA_PREV_TEST_DT||','|| NJA_TEST_TYPE||','||
    NJA_TEST_START_DT||','|| NJA_TEST_END_TIME||','|| NJA_EMISS_TEST_TYPE||','|| NJA_TEST_SEQ_NO||','
    ||NJA_LOW_MILE_EXEMP||','||NJA_TIRE_DRY||','|| NJA_REL_HUMID||','|| NJA_AMB_TEMP||','||NJA_BAR_PRESS||','|| NJA_HCF||','||
    NJA_GAS_CAP_ADAP_AVL||','|| NJA_GAS_CAP_REPL||','|| NJA_OVERALL_GAS_CAP_RES
    FROM NJAS
    WHERE NJA_RES_SYS_NO IN (SELECT MIN(NJA_RES_SYS_NO) FROM INSPECTION_RESULTS WHERE NJA_RES_SYS_NO IN
    (SELECT MAX(NJA_RES_SYS_NO) FROM INSPECTION_RESULTS, (SELECT SYSDATE-1 FROM DUAL))
    It works but not sure if I am getting accurate results. Can anyone help me fine tune this subquery script? Thanks!
    Scott

    Duplicate post
    See my answer in your other posting here Re: need help with script

  • Help with Subquery

    Hi All,
    I need help on a subquery to return multiple rows. I included this subquery in the select statement. Can someone help on the query
    select a.total  from TableA a where a.ID = b.ID and a.type = 'R' or a.total = 0
    Thanks
    Vani

    Here is the example. My req is to calculate the amount and reduced amount from the amount column based on the status
    Cust_no
    Status
    Amount
    12345
    Regular
    $50.26
    12345
    Discount
    $12
    22222
    Regular
    $233
    22222
    Discount
    $2
    23334
    DEFG
    0
    23333
    ABCD
    0
    I used CASE statement to the below output but the result was in multiple rows
    (Case when a.status <> ‘Discount’   then i.total) Amount
    (Case when a.status  = ‘Regular’ then i.total) Reduced_Amount
    Cust_no
    Status
    Amount
    Reduced Amount
    12345
    Regular
    $50.26
    12345
    Discount
    $12
    22222
    Regular
    $233
    22222
    Discount
    $2
    So I wrote a subquery to get the below output
    select a.amount  from TableA a where a.ID = b.ID and a.Status = 'R' and a.amount != 0
    Cust_no
    Amount
    Reduced Amount
    12345
    $50.26
    $12
    22222
    $233
    $2
    Now my req is to the get multiple rows from the subquery. How can i achieve that.
    select a.amount from TableA a where a.ID = b.ID and a.Status <> ‘Discount’ OR a.amount = 0
    Thanks,
    Vani

  • Help with group by

    Can anyone tell why this query isn't working? It returns NOT a group by expression error. It has something to do with the subquery but I know I can't group by the alias of that statement. Any help would be appreciated.
    SELECT acc.uprn,
    NVL (SUM (lth.balance), 0) balance,
    (SELECT SUM (balance)
    FROM lsc_transaction_history lth
    WHERE acc.account_no = lth.account_no
    AND SUBSTR (lth.account_no,10,3) = 450) repair_balance
    FROM lsc_occupants occ,
    lsc_account acc,
    lsc_area lmc,
    hpm_view_property p,
    lsc_account_parties_view accn,
    lsc_transaction_history lth
    WHERE occ.seq_no = acc.seq_no
    AND acc.uprn = occ.uprn
    AND occ.account_type = acc.account_type
    AND lmc.code = acc.area_code
    AND p.uprn = occ.uprn
    AND accn.account_no = acc.account_no
    AND lth.account_no = acc.account_no
    GROUP BY acc.uprn

    Well, the hints were already given, but maybe an example make it clearer.
    SQL> create table lsc_account
      2  as
      3  select 1 uprn, '100000000000' account_no from dual union all
      4  select 1, '100000000450' from dual union all
      5  select 2, '100000000450' from dual
      6  /
    Tabel is aangemaakt.
    SQL> create table lsc_transaction_history
      2  as
      3  select '100000000000' account_no, 100 balance from dual union all
      4  select '100000000000', 200 from dual union all
      5  select '100000000000', 300 from dual union all
      6  select '100000000450', 400 from dual union all
      7  select '100000000450', 500 from dual
      8  /
    Tabel is aangemaakt.
    SQL> SELECT acc.uprn
      2       , NVL (SUM (lth.balance), 0) balance
      3       , ( SELECT SUM (balance)
      4             FROM lsc_transaction_history lth
      5            WHERE acc.account_no = lth.account_no
      6              AND SUBSTR (lth.account_no,10,3) = 450
      7         ) repair_balance
      8    FROM lsc_account acc
      9       , lsc_transaction_history lth
    10   WHERE lth.account_no = acc.account_no
    11   GROUP BY acc.uprn
    12  /
              WHERE acc.account_no = lth.account_no
    FOUT in regel 5:
    .ORA-00979: Geen GROUP BY-uitdrukking.
    SQL> select acc.uprn
      2       , nvl(sum(lth.balance),0) balance
      3       , nvl(sum(case substr(lth.account_no,10,3) when '450' then balance end),0) repair_balance
      4    from lsc_account acc
      5       , lsc_transaction_history lth
      6   where lth.account_no = acc.account_no
      7   group by acc.uprn
      8  /
    UPRN      BALANCE REPAIR_BALANCE
       1         1500            900
       2          900            900You only need to access the lsc_transaction_history table once this way.
    Regards,
    Rob.

  • Anybody can help with this SQL?

    The table is simple, only 2 columns:
    create table personpay(
    id integer primary key,
    pay number(8,2) not null);
    So the original talbe looks like this:
    ID PAY
    1 800
    2 400
    3 1200
    4 500
    5 600
    6 1900
    The requirement is to use one single query(no pl/sql) to show something lile the following, in other words, for each ID, the pay is the sum of all before itself and itself. So the query result looks like this:
    ID PAY
    1 800
    2 1200
    3 2400
    4 2900
    5 3500
    6 5400
    Again, just use one sql. No pl/sql. Anybody can help with this? I really appreciate that.
    thanks,

    Eh, people are so "analytically minded" that can't even notice a simple join?
    Counting Ordered Rows
    Let’s start with a basic counting problem. Suppose we are given a list of integers, for example:
    x
    2
    3
    4
    6
    9
    and want to enumerate all of them sequentially like this:
    x      #
    2      1
    3      2
    4      3
    6      4
    9      5
    Enumerating rows in the increasing order is the same as counting how many rows precede a given row.
    SQL enjoys success unparalleled by any rival query language. Not the last reason for such popularity might be credited to its proximity to English . Let examine the informal idea
    Enumerating rows in increasing order is counting how many rows precede a given row.
    carefully. Perhaps the most important is that we referred to the rows in the source table twice: first, to a given row, second, to a preceding row. Therefore, we need to join our number list with itself (fig 1.1).
    Cartesian Product
    Surprisingly, not many basic SQL tutorials, which are so abundant on the web today, mention Cartesian product. Cartesian product is a join operator with no join condition
    select A.*, B.* from A, B
    Figure 1.1: Cartesian product of the set A = {2,3,4,6,9} by itself. Counting all the elements x that are no greater than y produces the sequence number of y in the set A.
    Carrying over this idea into formal SQL query is straightforward. As it is our first query in this book, let’s do it step by step. The Cartesian product itself is
    select t.x x, tt.x y
    from T t, T tt
    Next, the triangle area below the main diagonal is
    select t.x x, tt.x y
    from T t, T tt
    where tt.x <= t.x
    Finally, we need only one column – t.x – which we group the previous result by and count
    select t.x, count(*) seqNum
    from T t, T tt
    where tt.x <= t.x
    group by t.x
    What if we modify the problem slightly and ask for a list of pairs where each number is coupled with its predecessor?
    x      predecessor
    2      
    3      2
    4      3
    6      4
    9      6
    Let me provide a typical mathematician’s answer, first -- it is remarkable in a certain way. Given that we already know how to number list elements successively, it might be tempted to reduce the current problem to the previous one:
    Enumerate all the numbers in the increasing order and match each sequence number seq# with predecessor seq#-1. Next!
    This attitude is, undoubtedly, the most economical way of thinking, although not necessarily producing the most efficient SQL. Therefore, let’s revisit our original approach, as illustrated on fig 1.2.
    Figure 1.2: Cartesian product of the set A = {2,3,4,6,9} by itself. The predecessor of y is the maximal number in a set of x that are less than y. There is no predecessor for y = 2.
    This translates into the following SQL query
    select t.x, max(tt.x) predecessor
    from T t, T tt
    where tt.x < t.x
    group by t.x
    Both solutions are expressed in standard SQL leveraging join and grouping with aggregation. Alternatively, instead of joining and grouping why don’t we calculate the count or max just in place as a correlated scalar subquery:
    select t.x,
    (select count(*) from T tt where tt.x <= t.x) seq#
    from T t
    group by t.x
    The subquery always returns a single value; this is why it is called scalar. The tt.x <= t.x predicate connects it to the outer query; this is why it is called correlated. Arguably, leveraging correlated scalar subqueries is one the most intuitive techniques to write SQL queries.
    How about counting rows that are not necessarily distinct? This is where our method breaks. It is challenging to distinguish duplicate rows by purely logical means, so that various less “pure” counting methods were devised. They all, however, require extending the SQL syntactically, which was the beginning of slipping along the ever increasing language complexity slope.
    Here is how analytic SQL extension counts rows
    select x, rank() over(order by x) seq# from T; -- first problem
    select x, lag() over(order by x) seq# from T; -- second problem
    Many people suggest that it’s not only more efficient, but more intuitive. The idea that “analytics rocks” can be challenged in many ways. The syntactic clarity has its cost: SQL programmer has to remember (or, at least, lookup) the list of analytic functions. The performance argument is not evident, since non-analytical queries are simpler construction from optimizer perspective. A shorter list of physical execution operators implies fewer query transformation rules, and less dramatic combinatorial explosion of the optimizer search space.
    It might even be argued that the syntax could be better. The partition by and order by clauses have similar functionality to the group by and order by clauses in the main query block. Yet one name was reused, and the other had been chosen to have a new name. Unlike other scalar expressions, which can be placed anywhere in SQL query where scalar values are accepted, the analytics clause lives in the scope of the select clause only. I have never been able to suppress an impression that analytic extension could be designed in more natural way.

  • Help with query calculations (recursive)

    Hi All,
    I want some help with a query using a base rate and the result use in the next calculation year.
    Here an example:
    create table rate_type(
    rate_type_id    number,
    rate_desc       nvarchar2(50),
    rate_base_year  number
    insert into rate_type(rate_type_id, rate_desc, rate_base_year) values (1, 'Desc1', 4.6590);
    insert into rate_type(rate_type_id, rate_desc, rate_base_year) values (2, 'Desc2', 4.6590);
    create table rates (
    rate_type_id number
    rate_year    number,
    rate_value   number
    insert into rates(rate_type_id, rate_year, rate_value) values (1, 2012, 1.2);
    insert into rates(rate_type_id, rate_year, rate_value) values (1, 2013, 1.3);
    insert into rates(rate_type_id, rate_year, rate_value) values (1, 2014, 1.4);
    insert into rates(rate_type_id, rate_year, rate_value) values (2, 2012, 1.2);
    insert into rates(rate_type_id, rate_year, rate_value) values (2, 2013, 1.3);
    insert into rates(rate_type_id, rate_year, rate_value) values (2, 2014, 1.4);The calculation for the first year should be the base rate of the rate type. The next year should use the result of the previous year and so on.
    The result of my sample data is:
    2012 = 4.659 + 1.2 + 4.659 * (1.2 * 0.01) = 5.9149
    2013 = 5.9149 + 1.3 + 5.9149 * (1.3 * 0.01) = 7.1859
    2014 = 7.1859 + 1.4 + 7.1859 * (1.4 * 0.01) = 8.4721Query result:
    NAME 2012 2013 2014
    Desc1 5.9149 7.1859 8.4721
    Desc2 XXXX XXX XXXX
    How can I do this in one select statement? Any ideas?
    Thanks!

    Assuming you are on 11.2:
    with t as (
               select  a.rate_type_id,
                       rate_desc,
                       rate_year,
                       rate_base_year,
                       rate_value,
                       count(*) over(partition by a.rate_type_id) cnt,
                       row_number() over(partition by a.rate_type_id order by rate_year) rn
                 from  rate_type a,
                       rates b
                 where a.rate_type_id = b.rate_type_id
        r(
          rate_type_id,
          rate_desc,
          rate_year,
          rate_base_year,
          rate_value,
          cnt,
          rn,
          result
         ) as (
                select  rate_type_id,
                        rate_desc,
                        rate_year,
                        rate_base_year,
                        rate_value,
                        cnt,
                        rn,
                        rate_base_year + rate_value + rate_base_year * rate_value * 0.01 result
                  from  t
                  where rn = 1
               union all
                select  t.rate_type_id,
                        t.rate_desc,
                        t.rate_year,
                        t.rate_base_year,
                        t.rate_value,
                        t.cnt,
                        t.rn,
                        r.result + t.rate_value + r.result * t.rate_value * 0.01 result
                  from  r,
                        t
                  where t.rate_type_id = r.rate_type_id
                    and t.rn = r.rn + 1
    select  *
      from  (
             select  rate_desc name,
                     rate_year,
                     result
               from  r
               where rn <= cnt
      pivot (sum(result) for rate_year in (2012,2013,2014))
      order by name
    NAME             2012       2013       2014
    Desc1        5.914908  7.2918018 8.79388703
    Desc2        5.914908  7.2918018 8.79388703
    SQL> Obviously pivoting assumes you know rate_year values upfront. If not, then without pivoting:
    with t as (
               select  a.rate_type_id,
                       rate_desc,
                       rate_year,
                       rate_base_year,
                       rate_value,
                       count(*) over(partition by a.rate_type_id) cnt,
                       row_number() over(partition by a.rate_type_id order by rate_year) rn
                 from  rate_type a,
                       rates b
                 where a.rate_type_id = b.rate_type_id
        r(
          rate_type_id,
          rate_desc,
          rate_year,
          rate_base_year,
          rate_value,
          cnt,
          rn,
          result
         ) as (
                select  rate_type_id,
                        rate_desc,
                        rate_year,
                        rate_base_year,
                        rate_value,
                        cnt,
                        rn,
                        rate_base_year + rate_value + rate_base_year * rate_value * 0.01 result
                  from  t
                  where rn = 1
               union all
                select  t.rate_type_id,
                        t.rate_desc,
                        t.rate_year,
                        t.rate_base_year,
                        t.rate_value,
                        t.cnt,
                        t.rn,
                        r.result + t.rate_value + r.result * t.rate_value * 0.01 result
                  from  r,
                        t
                  where t.rate_type_id = r.rate_type_id
                    and t.rn = r.rn + 1
    select  rate_desc name,
            rate_year,
            result
      from  r
      where rn <= cnt
      order by name,
               rate_year
    NAME        RATE_YEAR     RESULT
    Desc1            2012   5.914908
    Desc1            2013  7.2918018
    Desc1            2014 8.79388703
    Desc2            2012   5.914908
    Desc2            2013  7.2918018
    Desc2            2014 8.79388703
    6 rows selected.
    SQL> SY.

Maybe you are looking for

  • Outlook connection to exchange server problem

    We have a new domain and an existing exchange server. The problem is if i log in with a local computer account i can autodiscover and connect in cached mode to exchange no problem. If i then login with a domain user account the same computer (tried o

  • Automator: There should be a "Target" action

    An awesome and powerful feature Apple should add to Automator would be a Target action.  This action would allow you to point to it from other actions and direct the workflow to that action.  Would be great for creating IF statements and branching in

  • IPad won't sync with iTunes

    iPad with iOS 7.1.2 will not sync with iTunes 11.1.3 An error called (-50) accurs. Installation of 7.1.2 wiped my apps from the iPad

  • Invoice Type not being Updated while Posting INVOIC01 - Incoming Invoice

    Hello,                 I am trying to Post Incoming Vendor Invoice in to SAP using INVOIC01 and IDOC_INPUT_INVOIC_MRM Function Module. I am adding values INVO for Invoice, CRMO for Credit Memo in the Field E1EDK01-BSART to Post the Invoice with diffe

  • Images as Buttons and Image Resizing in mxml

    Sorry for all the questions but I've run into a problem when trying to create buttons that are just an image in mxml. When I first tried this I couldn't find a way to get the border around the button to dissapear so it ended up looking like my image