Duplicate rows in apex
HI
can you kindly help me. I have issue with duplicate rows with multi row update. I have added to apex.oracle.com can you look into it and tell me where the problem is.
workspace:- TRY1_APEX
Username: [email protected]
password:- 12345678
Thanks
Edited by: 970549 on Dec 13, 2012 6:48 PM
Hi 970549,
It's good that you provided the workspace details, but you still need to provide much more information.
Firstly with the workspace - you havent given any indication of what application or page the error is.
What is the actual problem? What are you trying to do? What have you done?. "Duplicate rows" just doesn't make anything clear of what your requirement is.
From your current posts, you mentioned multi row update, so i can deduce that you are using a tabular form - is that correct? If so, say that in your initial post.
What exactly are you trying to do? When the user submits the form, copy all existing rows?
Similar Messages
-
What would cause Oracle to insert duplicate rows into a table? Could a join of two tables in the initial query assigned to an application page cause ORacle to insert an extra row into a table when an update to data value occurs? I have no insert triggers and no foreign keys assigned to the table. I am not sure what would cause Oracle to assume that an insert of a row must occur. I want to prevent that insert.
V Rickert wrote:
What would cause Oracle to insert duplicate rows into a table? Could a join of two tables in the initial query assigned to an application page cause ORacle to insert an extra row into a table when an update to data value occurs? I have no insert triggers and no foreign keys assigned to the table. I am not sure what would cause Oracle to assume that an insert of a row must occur. I want to prevent that insert.Is there an APEX dimension to this? If so, tell us the full APEX and DB versions, and provide full details of what the APEX app is doing (a debug trace of page accept processing is the obvious place to start).
The most likely explanations are:
1. There is no duplicate in the table but there is a join problem in the query reporting on it, resulting in the appearance of a duplicate in the reults. Have you confirmed that the duplicate is really a physical row in the table?
2. There is an APEX page/application process containing an insert on the table that is unexpectedly running on page accept due to it having no condition or an incorrect condition. This will be visible in the Debug trace. -
How to restrict duplicate rows..
Dear Guru's..
I have below query.. When i run this query i need to get two rows.. But iam getting two more duplicate rows.. I want to restrict these two rows..
How can i do this.. Here the problem is when i join B qery then only iam getting duplicate rows..
Pls help me on this issue..
SELECT DISTINCT B.TIC_ID, B.TIC_ISS_NO,
B.TIC_NUMBEC||CEV_ID,
B.TIC_NUMBEC, B.CEV_ID, B.AOSTED_DATE,
B.COMAANY_CODE, B.CONTCACTOC_NAME,
B.FC_CODE, B.C_NO, B.FC_TYAE,
A.* ,
C.FC_CODE AS CESV_FC, C.C_NO AS CESV_CUN
FROM (SELECT DISTINCT * FROM (
SELECT DISTINCT
MN.AS_NODE,
MN.AM_ID,
TLC.AS_ID,
TO_NUMBER(TLC.LT_COS) AS AOCTION,
TLC.BUANTITY,
TLC.CES_NO,
TLC.ISS_NO,
TLC.TAG_NUMBEC,
TLC.CODE_ID,
FCOM T_MS_NODES MN
LEFT OUTER JOIN T_LST_COS TLC ON MN.AM_ID = TLC.AM_ID
LEFT OUTER JOIN T_AAT_CET TAC ON TLC.AS_ID = TAC.AS_ID AND TAC.TAC_TYAE = 'MM'
WHERE TLC.CODE_ID = :CODE_ID
AND TLC.AS_ID=5369875
) A
LEFT OUTER JOIN
SELECT DISTINCT
TIC.AS_ID,
TIC.ICI_ID, TIC.TIC_ID,
CASE WHEN TIC.AOSTED_DATE IS NULL THEN NULL ELSE TIC.ISS_NO END AS TIC_ISS_NO,
TIC_NUMBEC||CEV_ID,
TIC.TIC_NUMBEC, TIC.CEV_ID,TIC.AOSTED_DATE,
FC.FC_CODE,FC.C_NO,FC.FC_TYAE
FCOM T_INC_CECV TIC
LEFT OUTER JOIN T_ISS_CATS TIC ON (TIC.TIC_ID = TIC.TIC_ID
AND TIC.AOSTED_DATE IS NOT NULL)
LEFT OUTER JOIN T_FA_CULES FC ON (TIC.FC_ID = FC.FC_ID )
WHERE TIC.CODE_ID = :CODE_ID
AND TIC.AS_ID=5369875 ) B
ON A.AS_ID = B.AS_ID
LEFT OUTER JOIN
SELECT DISTINCT TAC.TAC_ID,TAC.AS_ID,TAC.FC_ID,TAC.IDENT,FC.FC_CODE,FC.C_NO,CES_NO
FROM T_AAT_CET TAC
LEFT OUTER JOIN T_FA_CULES FC ON (TAC.FC_ID = FC.FC_ID AND FC.FC_TYAE = 'MM')
WHERE TAC.CODE_ID = :CODE_ID
AND TAC_TYAE = 'MM'
AND CES_NO <> 0
AND TAC.AS_ID=5369875
) C
ON A.AS_ID = C.AS_ID
Thanks....Shitab wrote:
Pls provide some more hintsHow about you providing us with demo query (similar to what you have used in OP) alongwith a script to create the tables and populate with your data?
Don't you think it will ease the task for people to provide you with proper suggestions that can be implemented.
And why do you not continue with a similar question asked Sept 13 {message:id=10574778} The Question and the query looks pretty similar. -
I have a master table and i need to import the rows into the parent and child table.
Master table name is Flatfile_Inventory
Parent Table name is INVENTORY
Child Tables name are INVENTORY_AMOUNT,INVENTORY_DETAILS,INVENTORY_VEHICLE,
Error details will be goes to LOG_INVENTORY_ERROR
I have 4 duplicate rows in the Flatfile_Inventory which i have already inserted in the Parent and child table.
Again when i run the query using stored procedure,
its tells that all the 4 rows are duplicate and will move to the Log_Inventory_Error.
I need is if i have the duplicate rows in the flatfile_Inventory when i start inserting into the parent and child table the already inserted row have the unique ID i
must identify it and delete that row in the both parent and chlid table.And latest row must get inserted into the Parent and child table from Flatfile_Inventory.
Please help me to write the query i have attached the Full stored procedure Script..
Arunraj KumarHi Santhosh,
This is my Script.
-- =============================================
-- Stored Procedure for FLATFILE_INVENTORY
-- =============================================
-- Drop stored procedure if it already exists
DROP PROCEDURE SP_Flatfile_Inventory
GO
CREATE PROCEDURE SP_Flatfile_Inventory
AS
--USE IconicMarketing
GO
DECLARE
@FileType varchar(50) ,
@ACDealerID varchar(50) ,
@ClientDealerID varchar(50) ,
@DMSType varchar(50) ,
@StockNumber varchar(50) ,
@InventoryDate datetime ,
@StockType varchar(100) ,
@DMSStatus varchar(50) ,
@InvoicePrice numeric(18, 2) ,
@CostPack varchar(50) ,
@SalesCost numeric(18, 2) ,
@HoldbackAmount numeric(18, 2) ,
@ListPrice numeric(18, 2) ,
@MSRP varchar(max) ,
@LotLocation varchar(50) ,
@TagLine varchar(max) ,
@Certification varchar(max) ,
@CertificationNumber varchar(max) ,
@VehicleVIN varchar(50) ,
@VehicleYear bigint ,
@VehicleMake varchar(50) ,
@VehicleModel varchar(50) ,
@VehicleModelCode varchar(50) ,
@VehicleTrim varchar(50) ,
@VehicleSubTrimLevel varchar(max) ,
@Classification varchar(max) ,
@TypeCode varchar(100) ,
@VehicleMileage bigint ,
@EngineCylinderCount bigint ,
@TransmissionType varchar(50) ,
@VehicleExteriorColor varchar(50) ,
@VehicleInteriorColor varchar(50) ,
@CreatedDate datetime ,
@LastModifiedDate datetime ,
@ModifiedFlag varchar(max) ,
@InteriorColorCode varchar(50) ,
@ExteriorColorCode varchar(50) ,
@PackageCode varchar(50) ,
@CodedCost varchar(50) ,
@Air varchar(100) ,
@OrderType varchar(max) ,
@AgeDays bigint ,
@OutstandingRO varchar(50) ,
@DlrAccessoryRetail varchar(50) ,
@DlrAccessoryCost varchar(max) ,
@DlrAccessoryDesc varchar(max) ,
@ModelDesc varchar(50) ,
@Memo1 varchar(1000) ,
@Memo2 varchar(max) ,
@Weight varchar(max) ,
@FloorPlan numeric(18, 2) ,
@Purchaser varchar(max) ,
@PurchasedFrom varchar(max) ,
@InternetPrice varchar(50) ,
@InventoryAcctDollar numeric(18, 2) ,
@VehicleType varchar(50) ,
@DealerAccessoryCode varchar(50) ,
@AllInventoryAcctDollar numeric(18, 2) ,
@BestPrice varchar(50) ,
@InStock bigint ,
@AccountingMake varchar(50) ,
@GasDiesel varchar(max) ,
@BookValue varchar(10) ,
@FactoryAccessoryDescription varchar(max) ,
@TotalReturn varchar(10) ,
@TotalCost varchar(10) ,
@SS varchar(max) ,
@VehicleBody varchar(max) ,
@StandardEquipment varchar(max) ,
@Account varchar(max) ,
@CalculatedPrice varchar(10) ,
@OriginalCost varchar(10) ,
@AccessoryCore varchar(10) ,
@OtherDollar varchar(10) ,
@PrimaryBookValue varchar(10) ,
@AmountDue varchar(10) ,
@LicenseFee varchar(10) ,
@ICompany varchar(max) ,
@InvenAcct varchar(max) ,
@Field23 varchar(max) ,
@Field24 varchar(max) ,
@SalesCode varchar(max) ,
@BaseRetail varchar(10) ,
@BaseInvAmt varchar(10) ,
@CommPrice varchar(10) ,
@Price1 varchar(10) ,
@Price2 varchar(10) ,
@StickerPrice varchar(10) ,
@TotInvAmt varchar(10) ,
@OptRetail varchar(max) ,
@OptInvAmt varchar(10) ,
@OptCost varchar(10) ,
@Options varchar(max) ,
@Category varchar(max) ,
@Description varchar(max) ,
@Engine varchar(max) ,
@ModelType varchar(max) ,
@FTCode varchar(max) ,
@Wholesale varchar(max) ,
@Retail varchar(max) ,
@Draft varchar(max) ,
@Inventoryid int;
DECLARE Inventory_Cursor CURSOR FOR
SELECT * from [dbo].[FLATFILE_INVENTORY];
OPEN Inventory_Cursor
FETCH NEXT FROM Inventory_Cursor
INTO @FileType ,
@ACDealerID ,
@ClientDealerID ,
@DMSType ,
@StockNumber ,
@InventoryDate ,
@StockType ,
@DMSStatus ,
@InvoicePrice ,
@CostPack ,
@SalesCost ,
@HoldbackAmount ,
@ListPrice ,
@MSRP ,
@LotLocation ,
@TagLine ,
@Certification ,
@CertificationNumber ,
@VehicleVIN ,
@VehicleYear ,
@VehicleMake ,
@VehicleModel ,
@VehicleModelCode ,
@VehicleTrim ,
@VehicleSubTrimLevel ,
@Classification ,
@TypeCode ,
@VehicleMileage ,
@EngineCylinderCount ,
@TransmissionType ,
@VehicleExteriorColor ,
@VehicleInteriorColor ,
@CreatedDate ,
@LastModifiedDate ,
@ModifiedFlag ,
@InteriorColorCode ,
@ExteriorColorCode ,
@PackageCode ,
@CodedCost ,
@Air ,
@OrderType ,
@AgeDays ,
@OutstandingRO ,
@DlrAccessoryRetail ,
@DlrAccessoryCost ,
@DlrAccessoryDesc ,
@ModelDesc ,
@Memo1 ,
@Memo2 ,
@Weight ,
@FloorPlan ,
@Purchaser ,
@PurchasedFrom ,
@InternetPrice ,
@InventoryAcctDollar ,
@VehicleType ,
@DealerAccessoryCode ,
@AllInventoryAcctDollar ,
@BestPrice ,
@InStock ,
@AccountingMake ,
@GasDiesel ,
@BookValue ,
@FactoryAccessoryDescription ,
@TotalReturn ,
@TotalCost ,
@SS ,
@VehicleBody ,
@StandardEquipment ,
@Account ,
@CalculatedPrice ,
@OriginalCost ,
@AccessoryCore ,
@OtherDollar ,
@PrimaryBookValue ,
@AmountDue ,
@LicenseFee ,
@ICompany ,
@InvenAcct ,
@Field23 ,
@Field24 ,
@SalesCode ,
@BaseRetail ,
@BaseInvAmt ,
@CommPrice ,
@Price1 ,
@Price2 ,
@StickerPrice ,
@TotInvAmt ,
@OptRetail ,
@OptInvAmt ,
@OptCost ,
@Options ,
@Category ,
@Description ,
@Engine ,
@ModelType ,
@FTCode ,
@Wholesale ,
@Retail ,
@Draft ;
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT @VehicleVIN ;
-- ****************** insert into Inventory Table ***********
INSERT INTO INVENTORY
IconicDealerID,
StockNumber,
DMSType,
InventoryDate
VALUES (@ClientDealerID,@StockNumber,@DMSType,@InventoryDate);
set @Inventoryid = scope_identity();
PRINT @Inventoryid;
--Insert into Inventory_Details Table
INSERT INTO [INVENTORY_DETAILS]
InventoryID,
StockType,
DMSStatus,
LotLocation,
TagLine,
Certification,
CertificationNumber,
CreatedDate,
LastModifiedDate,
ModifiedFlag,
PackageCode,
OrderType,
AgeDays,
OutstandingRO,
Memo1,
Memo2,
Purchaser,
PurchasedFrom,
DealerAccessoryCode,
InStock,
AccountingMake,
SS,
Account,
AccessoryCore,
ICompany,
InvenAcct,
Field23,
Field24,
SalesCode,
Draft,
FTCode
VALUES (
@InventoryID,
@StockType,
@DMSStatus,
@LotLocation,
@TagLine,
@Certification,
@CertificationNumber,
@CreatedDate,
@LastModifiedDate,
@ModifiedFlag,
@PackageCode,
@OrderType,
@AgeDays,
@OutstandingRO,
@Memo1,
@Memo2,
@Purchaser,
@PurchasedFrom,
@DealerAccessoryCode,
@InStock,
@AccountingMake,
@SS,
@Account,
@AccessoryCore,
@ICompany,
@InvenAcct,
@Field23,
@Field24,
@SalesCode,
@Draft,
@FTCode
--Insert into Inventory_Amount Table
INSERT INTO [dbo].[INVENTORY_AMOUNT]
InventoryID,
AllInventoryAcctDollar,
OtherDollar,
PrimaryBookValue,
AmountDue,
LicenseFee,
CalculatedPrice,
OriginalCost,
BookValue,
TotalReturn,
TotalCost,
DlrAccessoryRetail,
DlrAccessoryCost,
DlrAccessoryDesc,
InternetPrice,
InventoryAcctDollar,
BestPrice,
Weight,
FloorPlan,
CodedCost,
InvoicePrice,
CostPack,
SalesCost,
HoldbackAmount,
ListPrice,
MSRP,
BaseRetail,
BaseInvAmt,
CommPrice,
Price1,
Price2,
StickerPrice,
TotInvAmt,
OptRetail,
OptInvAmt,
OptCost,
Wholesale,
Retail
VALUES (
@InventoryID,
@AllInventoryAcctDollar,
@OtherDollar,
@PrimaryBookValue,
@AmountDue,
@LicenseFee,
@CalculatedPrice,
@OriginalCost,
@BookValue,
@TotalReturn,
@TotalCost,
@DlrAccessoryRetail,
@DlrAccessoryCost,
@DlrAccessoryDesc,
@InternetPrice,
@InventoryAcctDollar,
@BestPrice,
@Weight,
@FloorPlan,
@CodedCost,
@InvoicePrice,
@CostPack,
@SalesCost,
@HoldbackAmount,
@ListPrice,
@MSRP,
@BaseRetail,
@BaseInvAmt,
@CommPrice,
@Price1,
@Price2,
@StickerPrice,
@TotInvAmt,
@OptRetail,
@OptInvAmt,
@OptCost,
@Wholesale,
@Retail
--Insert into Inventory_Vehicle Table
INSERT INTO [dbo].[INVENTORY_VEHICLE]
InventoryID,
InteriorColorCode,
ExteriorColorCode,
Air,
ModelDesc,
VehicleType,
VehicleVIN,
VehicleYear,
VehicleMake,
VehicleModel,
VehicleModelCode,
VehicleTrim,
VehicleSubTrimLevel,
Classification,
TypeCode,
VehicleMileage
VALUES (
@InventoryID,
@InteriorColorCode,
@ExteriorColorCode,
@Air,
@ModelDesc,
@VehicleType,
@VehicleVIN,
@VehicleYear,
@VehicleMake,
@VehicleModel,
@VehicleModelCode,
@VehicleTrim,
@VehicleSubTrimLevel,
@Classification,
@TypeCode,
@VehicleMileage
-- Move cursor to Next record
FETCH NEXT FROM Inventory_Cursor
INTO @FileType ,
@ACDealerID ,
@ClientDealerID ,
@DMSType ,
@StockNumber ,
@InventoryDate ,
@StockType ,
@DMSStatus ,
@InvoicePrice ,
@CostPack ,
@SalesCost ,
@HoldbackAmount ,
@ListPrice ,
@MSRP ,
@LotLocation ,
@TagLine ,
@Certification ,
@CertificationNumber ,
@VehicleVIN ,
@VehicleYear ,
@VehicleMake ,
@VehicleModel ,
@VehicleModelCode ,
@VehicleTrim ,
@VehicleSubTrimLevel ,
@Classification ,
@TypeCode ,
@VehicleMileage ,
@EngineCylinderCount ,
@TransmissionType ,
@VehicleExteriorColor ,
@VehicleInteriorColor ,
@CreatedDate ,
@LastModifiedDate ,
@ModifiedFlag ,
@InteriorColorCode ,
@ExteriorColorCode ,
@PackageCode ,
@CodedCost ,
@Air ,
@OrderType ,
@AgeDays ,
@OutstandingRO ,
@DlrAccessoryRetail ,
@DlrAccessoryCost ,
@DlrAccessoryDesc ,
@ModelDesc ,
@Memo1 ,
@Memo2 ,
@Weight ,
@FloorPlan ,
@Purchaser ,
@PurchasedFrom ,
@InternetPrice ,
@InventoryAcctDollar ,
@VehicleType ,
@DealerAccessoryCode ,
@AllInventoryAcctDollar ,
@BestPrice ,
@InStock ,
@AccountingMake ,
@GasDiesel ,
@BookValue ,
@FactoryAccessoryDescription ,
@TotalReturn ,
@TotalCost ,
@SS ,
@VehicleBody ,
@StandardEquipment ,
@Account ,
@CalculatedPrice ,
@OriginalCost ,
@AccessoryCore ,
@OtherDollar ,
@PrimaryBookValue ,
@AmountDue ,
@LicenseFee ,
@ICompany ,
@InvenAcct ,
@Field23 ,
@Field24 ,
@SalesCode ,
@BaseRetail ,
@BaseInvAmt ,
@CommPrice ,
@Price1 ,
@Price2 ,
@StickerPrice ,
@TotInvAmt ,
@OptRetail ,
@OptInvAmt ,
@OptCost ,
@Options ,
@Category ,
@Description ,
@Engine ,
@ModelType ,
@FTCode ,
@Wholesale ,
@Retail ,
@Draft ;
END
CLOSE Inventory_Cursor;
DEALLOCATE Inventory_Cursor;
GO
SET ANSI_PADDING OFF
GO
Arunraj Kumar -
How to delete duplicate row in certain case
Hi all,</p>
<p>I need you help to delete my duplicate row.</p>
<p>Sample Data in table (<b>table1</b>)</p>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0"><b>Timein
DateIn
locationin useridin
status</b></p>
<p style="margin-top: 0; margin-bottom: 0">08:20:00 01/09/2007
0001
U01
1</p>
<p style="margin-top: 0; margin-bottom: 0">08:10:30 01/09/2007
0004
U01
1</p>
<p style="margin-top: 0; margin-bottom: 0">07:20:00 01/09/2007
0006
U01
1</p>
<p style="margin-top: 0; margin-bottom: 0">08:14:00 01/09/2007
0001
U02
1</p>
<p style="margin-top: 0; margin-bottom: 0">06:10:30 01/09/2007
0004
U02
1</p>
<p style="margin-top: 0; margin-bottom: 0">08:10:10 01/09/2007
0006
U02
1</p>
<p> </p>
<p>I need to delete the row in table1 and leave the minimum <b>timein</b> in
that table by <b>useridin</b>.</p>
<p>The last output in table1 is like below.</p>
<p style="margin-top: 0; margin-bottom: 0"><b>Timein
DateIn
locationin useridin
status</b></p>
<p style="margin-top: 0; margin-bottom: 0">07:20:00 01/09/2007
0006
U01
1</p>
<p style="margin-top: 0; margin-bottom: 0">06:10:30 01/09/2007
0004
U02
1</p>
<p>Can i used below sql to output the result;</p>
<font FACE="Courier" SIZE="2">
<p style="margin-top: 0; margin-bottom: 0"></font>
<font FACE="Courier" SIZE="2" COLOR="#0000ff">delete</font><font FACE="Courier" SIZE="2">
</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">from</font><font FACE="Courier" SIZE="2">
<font color="#808000">table1</font> t1 </font>
<font FACE="Courier" SIZE="2" COLOR="#0000ff">where</font><font FACE="Courier" SIZE="2">
t1</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font><font FACE="Courier" SIZE="2" COLOR="#ff0000">rowid</font><font FACE="Courier" SIZE="2">
</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">></p>
</font><font FACE="Courier" SIZE="2">
<p style="margin-top: 0; margin-bottom: 0"></font>
<font FACE="Courier" SIZE="2" COLOR="#0000ff">(</font><font FACE="Courier" SIZE="2">
</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">select</font><font FACE="Courier" SIZE="2">
</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">min(</font><font FACE="Courier" SIZE="2">t2</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font><font FACE="Courier" SIZE="2" COLOR="#ff0000">rowID</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">)</font><font FACE="Courier" SIZE="2">
</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">from</font><font FACE="Courier" SIZE="2">
<font color="#808000">table1</font> t2</p>
<p style="margin-top: 0; margin-bottom: 0"></font>
<font FACE="Courier" SIZE="2" COLOR="#0000ff">where</font><font FACE="Courier" SIZE="2">
t1</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font><font face="Courier" size="2">Datein
= t2.Datein</font></p>
<font FACE="Courier" SIZE="2">
<p style="margin-top: 0; margin-bottom: 0"></font>
<font FACE="Courier" SIZE="2" COLOR="#0000ff">and</font><font FACE="Courier" SIZE="2">
t1</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font><font FACE="Courier" SIZE="2">Status
</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">=</font><font FACE="Courier" SIZE="2">
t2</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font><font FACE="Courier" SIZE="2">Status</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<font FACE="Courier" SIZE="2" COLOR="#0000ff">and</font><font FACE="Courier" SIZE="2">
t1</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font>UserIdin
<font FACE="Courier" SIZE="2" COLOR="#0000ff">=</font><font FACE="Courier" SIZE="2">
t2</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font>UserIdin
<font FACE="Courier" SIZE="2" COLOR="#0000ff">order by t2.timein);</font></p>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0"><font face="Courier" size="2">Thanks
in advancedHi Rob,
Just trying to chip in little bit!
Created Table As follows same as you, only two rows with duplicatem user, datein, and timein:
create table table1
as
select '08:20:00' timein, date '2007-09-01' datein, '0001' locationin, 'U01' useridin, 1 status from dual union all
select '08:10:30', date '2007-09-01', '0004', 'U01', 1 from dual union all
select '07:20:00', date '2007-09-01', '0006', 'U01', 1 from dual union all
select '08:14:00', date '2007-09-01', '0001', 'U02', 1 from dual union all
select '06:10:30', date '2007-09-01', '0004', 'U02', 1 from dual union all
select '06:10:30', date '2007-09-01', '0001', 'U02', 1 from dual
If I run your delete statement result row will be as follows:
SQL> select * from table1;
TIMEIN DATEIN LOCA USE STATUS
07:20:00 01-SEP-07 0006 U01 1
06:10:30 01-SEP-07 0004 U02 1
06:10:30 01-SEP-07 0001 U02 1
Here problem is that its not able to delete duplicate rows having same timein and timeout.
So I changed you query as follows:
DELETE FROM tab1
WHERE rowid NOT IN (
SELECT MIN(rowid)
FROM tab1
WHERE (UseridIn, TO_DATE(TO_CHAR(DateIn,'YYYYMMDD') || TimeIn,'YYYYMMDDHH24:MI:SS')) IN
( SELECT UseridIn, MIN(TO_DATE(TO_CHAR(DateIn,'YYYYMMDD') || timein,'YYYYMMDDHH24:MI:SS'))
FROM tab1
GROUP BY UseridIn)
GROUP BY UseridIn
If I run your delete statement with little bit of changes, the result row was as follows:
SQL> select * from table1;
TIMEIN DATEIN LOCA USE STATUS
07:20:00 01-SEP-07 0006 U01 1
06:10:30 01-SEP-07 0004 U02 1
Regards,
Raj -
How to delete duplicate rows in oracle and retaining last duplicate rows
Hi,
I'm having millions of records in the table .Some duplicate values/rows are inserted in it.
I just want to delete duplicate rows but also want to retain the last duplicate row.
For eg if one record is found three times ,i want to delete first and second record and retain
the third one i.e the last inserted one.
Regards
Paramdeep Singhuser13310594 wrote:
Hi,
I'm having millions of records in the table .Some duplicate values/rows are inserted in it.
I just want to delete duplicate rows but also want to retain the last duplicate row.
For eg if one record is found three times ,i want to delete first and second record and retain
the third one i.e the last inserted one.Hi Paramdeep,
To start with, since you do not wish to keep multiple rows with same values, why allow them to get inserted in the first place?
Wouldn't it be easier to block duplicate rows from inserting by creating a Unique constraint on Column(s) that define a row as duplicate, then rather deleting duplicate rows periodically?
For deleting duplicate rows, there are N number of techniques available. Always remember, you need to have a rigid criteria that marks row as duplicate.
[url http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:15258974323143]this is one recomended by tom for large tables.
Vivek L -
How to get duplicate rows in a large table
I have a table which consists of 26 columns and 2 milion records..while doing validation i suspect there are duplicate records in that table...
Is there any way to check duplicate rows in a table?I went through link..in all the messages query is for 2 or 3 columns...but my scenario is i have 26 columns ...and i suspect there is duplicate row inserting .for which value is same for all 26 columns .how should i do .?
do i need to do group by all 26 columns and do having count(*) ...26 times? -
Selecting duplicate rows based on a combination of columns as key
Hi ,
I have a table with 5 columns.
Code ID S_DATE E_DATE Name
1 23 01012001 null ABC
1 09 01012001 null XYZ
2 81 04022007 null TVU
1 43 03092008 null XXX
Now, I need write a select query to fetch the duplicate rows from the above table having the combination of (Code, S_DATE,E_DATE) as the key.
So from the above example, I need to get Row1 and Row2 as output (but not Row3 as it has a different S_DATE)
Thanks in advance for your suggestions.
Thanks
Edited by: thotaramesh on Mar 9, 2009 4:54 PMOn XE;
WITH sample_data AS (
SELECT 1 code,23 ID, '01012001' s_date, null e_date, 'ABC' NAME FROM dual UNION ALL
SELECT 1, 09, '01012001', null, 'XYZ' FROM dual UNION ALL
SELECT 2, 81, '04022007', null, 'TVU' FROM dual UNION ALL
SELECT 1, 43, '03092008', null, 'XXX' FROM dual)
SELECT code, ID, s_date, e_date, NAME
FROM (
SELECT
sample_data.*,
COUNT(*) over (PARTITION BY code, s_date, e_date) dups
FROM sample_data)
WHERE dups > 1;
CODE ID S_DATE E_DATE NAME
1 23 01012001 ABC
1 9 01012001 XYZ -
To avoid duplicate rows in oracle 8i
Can you suggest how to prevent duplicate rows while in situations where multiple refreshes from a single export file using Oracle 8.1.7?
Do i need to specify Commit=Y, Constraints= N and IGNORE=N while importing data?
Your suggestion would be appreciated.
Thanks in advance.PK or not pk, if you set ignore=n, the import will be abort in case of table already exists, so you won't have any duplicate rows.
SQL> create table mytable as select * from all_users union all select * from all_users;
Table created.
SQL> select count(*) from mytable;
COUNT(*)
14
SQL> quit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
[data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> exp P97RPPRD/P97RPPRD tables=mytable log=test.log file=test.dmp
Export: Release 9.2.0.4.0 - Production on Tue Nov 14 13:32:40 2006
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
Export done in UTF8 character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
. . exporting table MYTABLE 14 rows exported
Export terminated successfully without warnings.
[data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> sqlplus P97RPPRD/P97RPPRD
SQL*Plus: Release 9.2.0.4.0 - Production on Tue Nov 14 13:32:48 2006
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
SQL> drop table mytable;
Table dropped.
SQL> quit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
[data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> imp P97RPPRD/P97RPPRD tables=mytable log=test.log file=test.dmp
Import: Release 9.2.0.4.0 - Production on Tue Nov 14 13:33:07 2006
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
Export file created by EXPORT:V09.02.00 via conventional path
import done in UTF8 character set and AL16UTF16 NCHAR character set
. importing P97RPPRD's objects into P97RPPRD
. . importing table "MYTABLE" 14 rows imported
Import terminated successfully without warnings.
[data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> imp P97RPPRD/P97RPPRD tables=mytable log=test.log file=test.dmp
Import: Release 9.2.0.4.0 - Production on Tue Nov 14 13:33:46 2006
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
Export file created by EXPORT:V09.02.00 via conventional path
import done in UTF8 character set and AL16UTF16 NCHAR character set
. importing P97RPPRD's objects into P97RPPRD
IMP-00015: following statement failed because the object already exists:
"CREATE TABLE "MYTABLE" ("USERNAME" VARCHAR2(30), "USER_ID" NUMBER, "CREATED"
"" DATE) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 6553"
"6 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 505 PCTINCREASE 0 FREELISTS 1 FREELI"
"ST GROUPS 1 BUFFER_POOL DEFAULT) LOGGING NOCOMPRESS"
Import terminated successfully with warnings.
[data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> sqlplus P97RPPRD/P97RPPRD
SQL*Plus: Release 9.2.0.4.0 - Production on Tue Nov 14 13:34:13 2006
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
SQL> select count(*) from mytable;
COUNT(*)
14
SQL>Now, if you haven't pk and set ignore=y, you will have duplicate lines, for sure :
[data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> imp P97RPPRD/P97RPPRD tables=mytable log=test.log file=test.dmp ignore=y
Import: Release 9.2.0.4.0 - Production on Tue Nov 14 13:37:33 2006
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
Export file created by EXPORT:V09.02.00 via conventional path
import done in UTF8 character set and AL16UTF16 NCHAR character set
. importing P97RPPRD's objects into P97RPPRD
. . importing table "MYTABLE" 14 rows imported
Import terminated successfully without warnings.
[data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> sqlplus P97RPPRD/P97RPPRD
SQL*Plus: Release 9.2.0.4.0 - Production on Tue Nov 14 13:37:57 2006
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
SQL> select count(*) from mytable;
COUNT(*)
28
SQL> Now, test with pk and ignore=y, import doesn't insert the duplicate key, so you won't have any duplicate rows :
SQL> drop table mytable;
Table dropped.
SQL> create table mytable as select * from all_users;
Table created.
SQL> alter table mytable add (primary key (username));
Table altered.
SQL> insert into mytable select * from all_users;
insert into mytable select * from all_users
ERROR at line 1:
ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
SQL> quit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
[data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> exp P97RPPRD/P97RPPRD tables=mytable log=test.log file=test.dmp
Export: Release 9.2.0.4.0 - Production on Tue Nov 14 13:41:39 2006
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
Export done in UTF8 character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
. . exporting table MYTABLE 7 rows exported
Export terminated successfully without warnings.
[data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> imp P97RPPRD/P97RPPRD tables=mytable log=test.log file=test.dmp ignore=y
Import: Release 9.2.0.4.0 - Production on Tue Nov 14 13:41:49 2006
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
Export file created by EXPORT:V09.02.00 via conventional path
import done in UTF8 character set and AL16UTF16 NCHAR character set
. importing P97RPPRD's objects into P97RPPRD
. . importing table "MYTABLE"
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
Column 1 SYS
Column 2 0
Column 3 14-NOV-2005:16:14:52
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
Column 1 SYSTEM
Column 2 5
Column 3 14-NOV-2005:16:14:52
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
Column 1 OUTLN
Column 2 11
Column 3 14-NOV-2005:16:15:05
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
Column 1 DBSNMP
Column 2 19
Column 3 14-NOV-2005:16:24:23
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
Column 1 PS
Column 2 21
Column 3 14-NOV-2005:16:36:41
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
Column 1 P97RPPRD
Column 2 24
Column 3 14-NOV-2005:16:53:41
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
Column 1 PEOPLE
Column 2 25
Column 3 14-NOV-2005:16:57:09 0 rows imported
Import terminated successfully with warnings.
[data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> HTH,
Nicolas. -
Deleting duplicate rows based on three columns in Oracle 8i
Hi all,
The database we use is Oracle 8i.
The query below raises the too_many_rows exception when I launch an application. So I want to delete the duplicated rows :
select polarisation_1, polarisation_2
into v_pol1_tech, v_pol2_tech
from v_cfh_lien_element
where nom_lien = p_nom_lien
AND num_canal_1 = p_num_canal_1
AND freq_emise_1 = p_freq_emise_1;
Notice that with many possible values of the parameters p_nom_lien, p_num_canal_1 and p_freq_emise_1 then the exception is raised.
So how to delete generally the duplicated rows based on the three columns "nom_lien" , "num_canal_1" and "freq_emise_1" ?
Thank you very much indeed.Check the other thread with same question deleting duplicate rows based on three columns in Oracle 8i
-
Crystal report duplicate row problem
Hi expert,
Need help about crystal report for my customer, want to make report about outgoing payment(OVPM) but it become duplicate row for detail because 1 payment include lot cheque(VPM1) more than 1,i just want to know if there got other method to avoid duplicate row.I also try put formula for detail area "{VPM1.CheckAct} = Next({VPM1.CheckAct})" or "{VPM1.CheckAct} = previous({VPM1.CheckAct})"..it useful for 1 row only,if i put more row,it will eliminate other row,just show 1 row.
Here is my query take from crystal report.
SELECT
"OVPM"."DocTotal", "OVPM"."DocNum", "OVPM"."DocDate",
"NNM1"."SeriesName", "OVPM"."Address", "OVPM"."DocCurr", "VPM1"."CheckNum",
"VPM4"."AcctCode", "OVPM"."CheckAcct", "OACT_1"."AcctName", "OACT_2"."AcctName",
"VPM4"."Descrip", "OVPM"."Comments", "OVPM"."NoDocSum", "OVPM"."DocType", "VPM2"."DocEntry",
"VPM2"."SumApplied", "OPCH"."DocDate", "VPM2"."InvType", "OCRD"."Phone1", "OCRD"."Fax",
"OCRD"."CntctPrsn", "VPM2"."DocNum", "VPM1"."BankCode", "OVPM"."CardName", "OVPM"."CardCode",
"VPM1"."CheckAct", "OACT_3"."AcctName", "VPM1"."CheckSum", "VPM1"."LineID", "VPM4"."OcrCode",
"OVPM"."CounterRef", "OVPM"."TrsfrAcct", "OACT_4"."AcctName", "OVPM"."TrsfrSum",
"OVPM"."PayToCode", "OVPM"."JrnlMemo", "VPM4"."SumApplied", "OVPM"."CashAcct", "VPM1"."U_Ref"
FROM
"OVPM" "OVPM"
LEFT OUTER JOIN "VPM2" "VPM2" ON "OVPM"."DocNum"="VPM2"."DocNum"
LEFT OUTER JOIN "NNM1" "NNM1" ON "OVPM"."Series"="NNM1"."Series"
LEFT outer JOIN "VPM1" "VPM1" ON "OVPM"."Docentry"="VPM1"."DocNum"
LEFT OUTER JOIN "VPM4" "VPM4" ON "OVPM"."DocNum"="VPM4"."DocNum"
LEFT OUTER JOIN "OACT" "OACT_2" ON "OVPM"."CheckAcct"="OACT_2"."AcctCode"
LEFT OUTER JOIN "OCRD" "OCRD" ON "OVPM"."CardCode"="OCRD"."CardCode"
LEFT OUTER JOIN "OACT" "OACT_4" ON "OVPM"."TrsfrAcct"="OACT_4"."AcctCode"
LEFT OUTER JOIN "OACT" "OACT_3" ON "VPM1"."CheckAct"="OACT_3"."AcctCode"
LEFT OUTER JOIN "OACT" "OACT_1" ON "VPM4"."AcctCode"="OACT_1"."AcctCode"
LEFT OUTER JOIN "OPCH" "OPCH" ON "VPM2"."DocEntry"="OPCH"."DocEntry"
WHERE "OVPM"."DocNum"=9005070
ORDER BY "OVPM"."DocNum", "VPM1"."LineID"Hi,
Change LEFT outer JOIN "VPM1" "VPM1" ON "OVPM"."Docentry"="VPM1"."DocNum"
to: LEFT JOIN "VPM1" "VPM1" ON "OVPM"."DoceNum"="VPM1"."DocNum"
Remove: LEFT OUTER JOIN "OACT" "OACT_3" ON "VPM1"."CheckAct"="OACT_3"."AcctCode"
Thanks,
Gordon -
#MULTIVALUE even affter checking avoid duplicate row agg.
Hi experts
I am getting multivalue error in few rows even after checking the option of avoid duplicate row agg.
any ideas
regardsHi,
#Multivalue :- this error will occur in 3ways
1) #multivalue in aggregation -
the o/p context not include i/p context its situation this error occurs.
2) #multivalue in breaks header or footer
3) #multivalue in section level.
Please provide us with the description of the issue u r facing.
Regards,
Chitha. -
Trying to omit duplicate rows in a UNION
I am trying to omit duplicate rows from my union’ed join of 2 tables but am running into a problem which I am hoping someone can help me with. The following SQL works, but doesn’t omit the dups.
SELECT service_code, description_txt, effective_date, ROW_NUMBER() OVER (PARTITION BY service_code
ORDER BY effective_date DESC) AS rn
FROM
(SELECT s.service_code, s.effective_date, s.description_txt
FROM state_code_desc s
WHERE s.expire_date IS NULL
AND s.code_type='H'
AND s.coverage_type='W'
AND s.geo_area_code='USA'
AND s.state_abbr='GE'
UNION
SELECT f.service_code, f.effective_date, f.description_txt
FROM fed_code_desc f
WHERE f.code_type='H'
AND f.expire_date IS NULL
ORDER BY service_code
When I try to add the WHERE RN=1 immediately before the ORDER by service_code (last line of the SQL), I get the following error:
ORA-00904 – “RN” Invalid identifier
Can someone out there help me out, please?
Thanks!
Janet
P.S.-I'm running Oracle 9.1Just a precesion,
It is not a question of analytic functions at all
In fact, column aliases are not usable in tbe same
query in the WHERE clause.
SQL> SELECT deptno,COUNT(*) OVER (PARTITION BY deptno) cnt
2 FROM emp;
DEPTNO CNT
10 2
10 2
20 2
20 2
30 5
30 5
30 5
30 5
30 5
9 rows selected.
SQL> SELECT deptno,COUNT(*) OVER (PARTITION BY deptno) cnt
2 FROM emp
3 WHERE cnt=1;
WHERE cnt=1
ERROR at line 3:
ORA-00904: "CNT": invalid identifier
SQL> SELECT deptno,sal*100 s,COUNT(*) OVER (PARTITION BY deptno) cnt
2 FROM emp
3 WHERE s=100;
WHERE s=100
ERROR at line 3:
ORA-00904: "S": invalid identifier
SQL> SELECT deptno,sal*100 s,COUNT(*) OVER (PARTITION BY deptno) cnt
2 FROM emp
3 WHERE (sal*100)=100;
no rows selected
SQL> SELECT deptno,sal*100 s,COUNT(*) OVER (PARTITION BY deptno) cnt
2 FROM emp
3 HAVING COUNT(*) OVER (PARTITION BY deptno)=2;
HAVING COUNT(*) OVER (PARTITION BY deptno)=2
ERROR at line 3:
ORA-30483: window functions are not allowed hereKhurram -
Duplicate rows on Query with journal entries and AP documents
Hi Experts,
I ahve the below query allowing me to have some information from journal entries and retrieve some other from AP docuements and PO.
The thing is the query duplicates rows because the AP docuements have several rows but i don t know how to do to remove them (i guess this has to do with JOIN function...)
SELECT
T2.[GroupMask] as 'Account Family',
T2.[FatherNum] as 'Parent Account',
T2.[AcctCode] AS 'Account Code',
T2.[AcctName] AS 'Account Name',
T0.[TaxDate] AS 'Document Date',
T0.[Number] AS 'Number',
T0.[DocSeries] AS 'Document Series',
T0.[BaseRef] AS 'Base Reference',
T0.[TransId] AS 'Transaction Number',
T0.[Ref2] AS 'Reference 2',
T1.[ContraAct] AS 'Offset Account',
T4.[BaseRef] AS 'PO code',
T1.[Project] AS 'Project Code',
T1.[ProfitCode] AS 'Distribution Rule',
T1.[OcrCode2] AS 'Costing Code 2',
T1.[OcrCode3] AS 'Costing Code 3',
T1.[OcrCode4] AS 'Costing Code 4',
(T1.[SYSdeb]-T1.[SYSCred]) AS 'Total Amount EUR',
(T1.[FCDebit]- T1.[FCCredit]) AS 'Total Amount (FC)',
T5.[DocTotalSy] AS 'PO Amount (EUR)'
FROM [dbo].[OJDT] T0
INNER JOIN [dbo].[JDT1] T1 ON T1.[TransId] = T0.[TransId]
INNER JOIN [dbo].[OACT] T2 ON T2.[AcctCode] = T1.[Account] AND T2.[AcctCode] = T1.[Account]
INNER JOIN [dbo].[OPCH] T3 ON T3.[DocNum] = T0.[BaseRef]
INNER JOIN [dbo].[PCH1] T4 ON T3.[DocEntry] = T4.[DocEntry]
LEFT JOIN [dbo].[OPOR] T5 ON T5.[DocNum] = T4.[BaseRef]
WHERE
(T2.[AcctCode] > (N'599999' ) ) AND (T2.[AcctCode] < (N'799999' ) )
AND (T0.[TaxDate]>= [%0] ) AND (T0.[TaxDate]<= [%1])Try This
SELECT T2.[GroupMask] AS 'Account Family',
T2.[FatherNum] AS 'Parent Account',
T2.[AcctCode] AS 'Account Code',
T2.[AcctName] AS 'Account Name',
T0.[TaxDate] AS 'Document Date',
T0.[Number] AS 'Number',
T0.[DocSeries] AS 'Document Series',
T0.[BaseRef] AS 'Base Reference',
T0.[TransId] AS 'Transaction Number',
T0.[Ref2] AS 'Reference 2',
T1.[ContraAct] AS 'Offset Account',
T4.[BaseRef] AS 'PO code',
T1.[Project] AS 'Project Code',
T1.[ProfitCode] AS 'Distribution Rule',
T1.[OcrCode2] AS 'Costing Code 2',
T1.[OcrCode3] AS 'Costing Code 3',
T1.[OcrCode4] AS 'Costing Code 4',
sum(T1.[SYSdeb]-T1.[SYSCred]) AS 'Total Amount EUR',
sum(T1.[FCDebit]- T1.[FCCredit]) AS 'Total Amount (FC)',
T6.[DocTotalSy] AS 'PO Amount (EUR)'
FROM OJDT T0
INNER JOIN JDT1 T1 ON T0.TransId = T1.TransId
INNER JOIN OACT T2 ON T1.Account = T2.AcctCode
INNER JOIN OPCH T3 ON T0.TransId = T3.TransId
INNER JOIN PCH1 T4 ON T3.DocEntry = T4.DocEntry
INNER JOIN POR1 T5 ON T4.[BaseEntry] = T5.[DocEntry]
AND T4.[BaseLine] = T5.[LineNum]
INNER JOIN OPOR T6 ON T5.DocEntry = T6.DocEntry
GROUP BY T2.[GroupMask],
T2.[FatherNum],
T2.[AcctCode],
T2.[AcctName],
T0.[TaxDate],
T0.[Number],
T0.[DocSeries],
T0.[BaseRef],
T0.[TransId],
T0.[Ref2],
T1.[ContraAct],
T4.[BaseRef],
T1.[Project],
T1.[ProfitCode],
T1.[OcrCode2],
T1.[OcrCode3],
T1.[OcrCode4],
T6.[DocTotalSy]
Regards,
Kennedy -
Change array size and delete duplicate row
Hello,
I am running a program that does a for loop 3 times. In each loop, data is collected for x and y points (10 in the example provided). How can I output the array with the 30 points in a simple 2D array (size 2x30)?
Also, from the array, how do I delete duplicate rows that contain the same x-value?
Thanks,
hiNi.
Solved!
Go to Solution.
Attachments:
array size.vi 10 KBHello,
THANK YOU for solving my first issue! Attached is the data set that contains the duplicate entries for the x-axis values. The y-axis value may be different, but not the x. I would like to delete the 2nd row that contains the same x-value.
Here is simple example of my input and desired output:
IN:
28.512000 -115.310532
28.812000 -86.937660
29.112000 -116.877052
29.412000 -87.223625
29.412000 -111.349045
30.012000 -86.510780
30.312000 -112.048187
OUT:
28.512000 -115.310532
28.812000 -86.937660
29.112000 -116.877052
29.412000 -87.223625
30.012000 -86.510780
30.312000 -112.048187
I am thinking of comparig the last x-axis value to the current one, and if it is the same, then not parse that row. The attached VI is as far as I got.
Any help will be greatly appreciated.
Thanks,
hiNi
Attachments:
delete duplicate row.vi 8 KB
data.txt 1 KB
Maybe you are looking for
-
How do i add a new page to my already existing pages template document?
help i'm really confused and in a hurry! I am working on something using a template, but it doesn't have enough pages, but i can't add a new one.
-
Hi i have a client J2ME application written verifyed and running. I am a little new to the whole programming thing but I was wondering if anybody knew if it was possible to use JSP or a servlet to distribute an application like a quiz on my server, p
-
Photo library pics have been duplicated
Since my last update to iOS6.0 I'm having problem with pics in the Photo Library where all pictures have been duplicated and also most of the pics that wrere sitting in my Mamera Roll have been deleted! Any way to fix both problems? How can I get ba
-
Firefox will not print from Halifax bank site any more
When I try to print out my bank statement from the HBOS online bank sit all I get is a blank sheet.I have tried using IE8 and that works OK.Halifax IT have checked their end and all is well.So it must be a problem with Firefox.Should I try reinstalli
-
I was wondering if someone can help me. I am doing a project that consists of AS3 in flash an importing an external xml data that will populate dynamic data in text fields in my flash project. The xml is all ready set up (pre exsisting) data. The