Select duplicate Data with same No.
Dear All experts,
How we giong to select the data with same No as 1 record count.
example : Bellow is the sample table contains 5 rows records, but of records ard same number.
post No. Name
1001 Jacky
1001 Jimmy
1002 Mark
1003 Jin
1004 chloe
when i use the select statement bellow :
Select * from table into corresposding of table t_table up to 3.
will get the result like below .
1001 Jacky
1001 Jimmy
1002 Mark
Question is , how i going to write the statement to get the 3(depend on user insert how many record) different no. example , 2records of 1001, 1002 , and 1003 .
if its a ztable then better to keep a counter field for your requirement.
else.
parameter : count type i. "this holds number of required data.
select * from TT_XYZ into table gt_itab.
loop at gt_itab into gs_itab.
at end of post_no.
count = count - 1.
endat.
if count = 0.
exit.
endif.
append gs_itab to gt_itab2.
clear gs_itab.
endloop.
now gt_itab2 holds required entries for you.
Similar Messages
-
Duplicate record with same primary key in Fact table
Hi all,
Can the fact table have duplicate record with same primary key . When i checked a cube i could see records with same primary key combination but the key figure values are different. My cube has 6 dimentions (Including Time,Unit and DP) and 2 key figures. So 6 fields combined to form the composite primary key of the fact table. When i checked the records in se16 i could see duplicate records with same primary key. Ther are no parallel loading happening for the cube.
BW system version is 3.1
Data base is : Oracle 10.2
I am not sure how is this possible.
Regards,
PMHi Krish,
I checked the datapacket dimention also. Both the record have same dimention id (141). Except the Keyfigure value there is no other change in the Fact table record. I know this is against the basic DBMS primary key rule. But i have records like this in the cube.
Can this situation arise when same records is there in different data packet of same request.
Thx,
PM
null -
Select three tables data with Same where condition
Hi i want sum data in three tables with same where condition. how can i do this code very simple.
SELECT SUM(SIGNA) FROM dbo.tblPLAG
WHERE VERSION='ACTUAL' AND STATS='ST_Z010'
AND FACILITY='FA_2003'
AND TD IN ( SELECT TIMEID FROM Time WHERE ID BETWEEN
@YEAR+'.'+(SELECT RIGHT ('000'+ CAST (@PERIOD-6 AS varchar), 3))
AND
@YEAR +'.'+(SELECT RIGHT ('000'+ CAST (@PERIOD AS varchar), 3)))
Try following
SELECT SUM(t1.SIGNA) + sum(t2.SIGNA) + sum(t3.SIGNA) and you query, it will add the SUMs of each table.. hopefully it will work -
[JS CS3] Frontmost document/selection when other with same name?
I have a few scripts used to perform various operations on the current selection in InDesign. Under normal circumstances these work fine, but I can't seem to reliably get the frontmost document/selection when there is another document open with the same name. Most references to the document and every reference to the selection I have tried so far will simply lead to the document which was most recently opened (and has the same name).
app.activeDocument.fullName always return the path to the most recently opened document of the same name, but app.documents[0].fullName will return the correct path. Trying to get the selection though will always return the selection of the most recently opened document of the same name, regardless of whether I try app.selection, app.activeDocument.selection or app.documents[0].selection. I have also tried with getElements()[0] appended to the document reference but it makes no difference.
My primary environment is still CS3 and the problem appears to be that it only references documents by name. Brief testing with CS5 indicates this has been solved by Adobe, presumably because it now refers to documents using an id by default. Haven't tried CS4 but since its document object does not have an id property I'd assume it will behave the same as CS3. Is there any way around this, or is the best I can do to detect the issue (a simple app.activeDocument != app.documents[0] comparison seems to work reliably) and refuse to run if encountered?Welll...chances are the selected item will not be a valid ID in both documents of the same name. (I don't think ID's are globally unique, so that's not a guarantee -- but it's something you can check and only give an error if it happens to be that there is a collison).
So, get the transaction specifier of the selection:
app.activeWindow.selection[0].toSpecifier()
Result: /document[@name="u1.indd"]//text-frame[@id=211]
Then, iterate over app.documents to find the indexes of the documents with that name.
In my test, of course it is just zero and one.
Then, try to resolve the specifiers against those documents:
resolve("/document[0]//text-frame[@id=211]")
Result: [object TextFrame]
resolve("/document[1]//text-frame[@id=211]")
Error: Object is invalid
Since only doc 0 has a textFrame with id 211, you know it's doc 0 and you have a valid specifier.
I chose to adjust the specifier by hand, because I think that's probably the most general. The other choice would be to call app.documents[0].textFrames.itemByID(211), but then you would need to map "text-frame" to "textFrames" and that seems annoying and errorprone. -
Select of date with yyyymmdd format
HI I have a report that I want to select the current date -1.
but our dates are in this format
YYYYMMDD so I cant just use 'current date?What database are you reporting against?
If you're using Oracle, you should consider creating a SQL Expression field with this code:
TO_CHAR("DATE_FIELD", 'yyyymmdd')
You can then use this field in the Record Selection formula to make sure the query generated contains a where clause. The record selection would be:
totext(currentdate-1, "yyyyMMdd") = {%SQL_Expression_Formula}
If you're using SQL Server, the SQL Expression formula would be:
replace(convert(varchar, "DATE_FIELD", 111), '/','')
-Abhilash -
Select multiple date with interval in date-navigator
Hi,
Is it possible to have a multiple date selection with interval in a date-navigator. When yes, how?
Richard MiddelburgLook at the below thread:
Re: Date Navigator Challenge
Raja T -
Messages in Oracle SOA-ESB queues duplicate - enqueing with same ENQ_TXN_ID
Hi,
We have a flow which accepts payloads from a third party application and this payload is enqueued into an advanced queue. Another process dequeues these payloads and does further processing. During the process of enqueuing, we observe that one payload gets enqueued more than once. I have observed that these messages get the same ENQ_TXN_ID. Please note that this issue happens sporadically.
Please advice if there is any patch that should be applied to fix the multiple enqueue issue.
This issue is seen in the production instance.
We are able to reproduce this error in QA also. But so far, no solution is working.
Below is the script used to create our queue.
BEGIN
dbms_aqadm.stop_queue(queue_name=>'SAVE_REQUISITION_Q');
dbms_aqadm.drop_queue(queue_name=>'SAVE_REQUISITION_Q');
dbms_aqadm.drop_queue_table(queue_table=>'SAVE_REQUISITION_Q_TAB');
dbms_aqadm.create_queue_table(queue_table=>'SAVE_REQUISITION_Q_TAB',
queue_payload_type=>'sys.aq$_jms_text_message',multiple_consumers=>true);
dbms_aqadm.create_queue(queue_name=>'SAVE_REQUISITION_Q', queue_table=>'SAVE_REQUISITION_Q_TAB');
dbms_aqadm.start_queue(queue_name=>'SAVE_REQUISITION_Q');
END;
Please help.
Thanks,
Ved
Edited by: user582595 on Mar 1, 2012 7:56 AMAnyone with JMS queue knowledge please help me fix this problem. This is happening in production and Oracle support is not able to suggest a resolution yet. They are working with me, but I would need to resolve this issue ASAP.
Thanks much,
ved -
Select Vender data with first 2 digit
Hi,
I have a requirement. In selection screen i need a parameter with 2 digit.
As per this parameter, i need to select all the venders start with this 2 digit from LFA1.
What should be the select where condition.
Thanks and Regards
Joby Jacob
Moderator message: very basic, please search for available information and try yourself before asking.
locked by: Thomas Zloch on Sep 3, 2010 11:33 AMDepends on the quality of Netflix streaming that you used.
https://support.netflix.com/en/node/87
Manage Bandwidth Usage
Low (uses up to 0.3 GB per hour)
Medium (uses up to 0.7 GB per hour)
High (uses up to 1 GB per hour, up to 2.8 GB per hour if watching HD, or up to 4.7 GB per hour if watching 3D)
Auto (adjusts itself automatically to deliver the highest possible quality, based on your current internet connection speed) -
Easy way to create a register (duplicate boxes with same formatting, diffrent text)
I'm trying to create like a register over about 200 people with information about name, age, adress and so on. I wonder if there is a function that formattes this easely?
As i see it, the pages will consist of like 20 boxes, all with the same layout but with some of the text diffrent. Lets say that after ive created like 40 of these, i see that i need to change i.e. the fonttype, i dont want to do it 40 times, one for each of the boxes.
I think the boxes will be somthing like this:
Name: <Firstname> <Lastname>
Age: <Age>
From: <Adress>
School: <School>
Sorry for my bad englishhttp://layersmagazine.com/using-the-next-style-paragraph-feature-in-indesign.html
http://blogs.adobe.com/indesignchannel/2007/11/real_world_apply_next.html
Perhaps these tips will help -
How to Select data using same column name from 3 remote database
Hi,
Can anyone help me on how to get data with same column names from 3 remote database and a single alias.
Ex.
SELECT *
a.name, b.status, SUM(b.qty) qantity, MAX(b.date) date_as_of
FROM
*((table1@remotedatabase1, table1@remotedatabase2, table1@remotedatabase3)a,*
*(table1@remotedatabase1, table1@remotedatabase2, table1@remotedatabase3)b)*
WHERE b.dept = 'finance'
AND a.position = 'admin'
AND a.latest = 'Y' AND (b.status <> 'TRM') AND b.qty > 0;
GROUP BY a.name, b.status ;
NOTE: the bold statements is just an example of what I want to do but I always gets an error beacause of ambiguous columns.
Thanks in advnce. :)
Edited by: user12994685 on Jan 4, 2011 9:42 PMuser12994685 wrote:
Can anyone help me on how to get data with same column names from 3 remote database and a single alias.Invalid. This does not make sense and breaks all scope resolution rules. And whether this is in a single database, or uses tables across databases, is irrelevant.
Each object must be uniquely identified. So you cannot do this:
select * from (table1@remotedatabase1, table1@remotedatabase2, table1@remotedatabase3) a3 objects cannot share the same alias. Example:
SQL> select * from (dual, dual) d;
select * from (dual, dual) d
ERROR at line 1:
ORA-00907: missing right parenthesisYou need to combine the objects - using a join or union or similar. So it will need to be done as follows:
SQL> select * from (select * from dual d1, dual d2) d;
select * from (select * from dual d1, dual d2) d
ERROR at line 1:
ORA-00918: column ambiguously definedHowever, we need to have unique column names in a SQL projection - so the join of the tables need to project a unique set of columns. Thus:
SQL> select * from (select d1.dummy as dummy1, d2.dummy as dummy2 from dual d1, dual d2) d;
DUM DUM
X X
SQL> I suggest that you look closely at what scope is and how it applies in the SQL language - and ignore whether the objects referenced are local or remote as it has no impact to fundamentals of scope resolution. -
How to delete the duplicate data in between two distinct rows in SQL?
Hi,
I need to identify the duplicate data with two distinct rows. See my data structure below.
NAME NAME_1 VALUE START_DATE END_DATE FLAG INDEX
SUR SE 275 13/12/2005 31/12/2010 B 1
SUR SE 375 A 1
SUR SE 475 A 1
SUR SE 275 13/12/2005 31/12/2010 B 2
SUR SE 375 A 2
SUR SE 475 A 2
SUR SE 175 13/12/2006 31/12/2010 B 3
SUR SE 375 A 3
SUR SE 475 A 3
This is my sample data. Here data are duplicate with different index columns. INDEX 1 and 2 contains same group of combination. So i need to identify any one of duplicate combination(i.e INDEX 1 or 2). Can anyone come up with exact solution?
ThanksTry this:
with test_table as
(select 'SUR' NAME, 'SE' NAME_1, 275 VALUE, '13/12/2005' START_DATE, '31/12/2010' END_DATE, 'B' FLAG, 1 IND from dual union all
select 'SUR', 'SE', 375, null, null, 'A', 1 from dual union all
select 'SUR', 'SE', 475, null, null, 'A', 1 from dual union all
select 'SUR', 'SE', 275, '13/12/2005' ,'31/12/2010' ,'B', 2 from dual union all
select 'SUR', 'SE', 375, null, null, 'A', 2 from dual union all
select 'SUR', 'SE', 475, null, null, 'A', 2 from dual union all
select 'SUR', 'SE', 175, '13/12/2006', '31/12/2010', 'B', 3 from dual union all
select 'SUR', 'SE', 375, null, null, 'A', 3 from dual union all
select 'SUR', 'SE', 475, null, null, 'A', 3 from dual )
select t.*,
CASE WHEN START_DATE IS NULL THEN
first_value(row_number) OVER (PARTITION BY NAME, NAME_1, IND ORDER BY START_DATE)
ELSE
row_number
END row_number
from (
SELECT t.*,
CASE WHEN START_DATE IS NOT NULL THEN
row_number() over(PARTITION BY NAME, NAME_1,VALUE, START_DATE, END_DATE, FLAG
ORDER BY IND)
END row_number
FROM test_table t) t
order by IND, start_dateNote that this is only checking for diferences in the rows where start_date is not null. Do you want to also check if the records where start_date is null it there are differences? If so you can do this:
with test_table as
(select 'SUR' NAME, 'SE' NAME_1, 275 VALUE, '13/12/2005' START_DATE, '31/12/2010' END_DATE, 'B' FLAG, 1 IND from dual union all
select 'SUR', 'SE', 375, null, null, 'A', 1 from dual union all
select 'SUR', 'SE', 475, null, null, 'A', 1 from dual union all
select 'SUR', 'SE', 275, '13/12/2005' ,'31/12/2010' ,'B', 2 from dual union all
select 'SUR', 'SE', 375, null, null, 'A', 2 from dual union all
select 'SUR', 'SE', 475, null, null, 'A', 2 from dual union all
select 'SUR', 'SE', 175, '13/12/2006', '31/12/2010', 'B', 3 from dual union all
select 'SUR', 'SE', 375, null, null, 'A', 3 from dual union all
select 'SUR', 'SE', 475, null, null, 'A', 3 from dual )
SELECT t.*,
MIN(row_number) OVER(PARTITION BY NAME, NAME_1, IND) MIN
FROM (SELECT t.*,
row_number() over(PARTITION BY NAME, NAME_1, VALUE,
START_DATE, END_DATE, FLAG
ORDER BY IND) row_number
FROM test_table t) t
ORDER BY IND,
start_date;Edited by: Manuel Vidigal on 13/Abr/2009 12:05 -
iPad2... after synch with my Mac, I now have numerous duplicates of the same PDF files in Books. Can't select them to delete them. Can't move them. Any suggestions?
<Email Edited by Host>Hi sdfulbright,
Open iTunes, and under View, select "Show Sidebar". The old sidebar you are used to will show up, and everything will work the way it did under the old iTunes.
Hope this helps!
Cheers,
GB -
Hi everyone, again landed up with a problem.
After trying a lot to do it myself, finally decided to post here..
I have created a form in form builder 6i, in which on clicking a button the data gets exported to excel sheet.
It is working fine with a single table. The problem now is that i am unable to do the same with 2 tables.
Because both the tables have same number of columns & column names.
Below are 2 tables with column names:
Table-1 (MONTHLY_PART_1)
Table-2 (MONTHLY_PART_2)
SL_NO
SL_NO
COMP
COMP
DUE_DATE
DUE_DATE
U-1
U-1
U-2
U-2
U-4
U-4
U-20
U-20
U-25
U-25
Since both the tables have same column names, I'm getting the following error :
Error 402 at line 103, column 4
alias required in SELECT list of cursor to avoid duplicate column names.
So How can i export the data to excel which has 2 tables with same number of columns & column names?
Should i paste the code? Should i post this query in 'SQL and PL/SQL' Forum?
Help me with this please.
Thank You.You'll have to *alias* your columns, not prefix it with the table names:
$[CHE_TEST@asterix1_impl] r
1 declare
2 cursor cData is
3 with data as (
4 select 1 id, 'test1' val1, 'a' val2 from dual
5 union all
6 select 1 id, '1test' val1, 'b' val2 from dual
7 union all
8 select 2 id, 'test2' val1, 'a' val2 from dual
9 union all
10 select 2 id, '2test' val1, 'b' val2 from dual
11 )
12 select a.id, b.id, a.val1, b.val1, a.val2, b.val2
13 from data a, data b
14 where a.id = b.id
15 and a.val2 = 'a'
16 and b.val2 = 'b';
17 begin
18 for rData in cData loop
19 null;
20 end loop;
21* end;
for rData in cData loop
ERROR at line 18:
ORA-06550: line 18, column 3:
PLS-00402: alias required in SELECT list of cursor to avoid duplicate column names
ORA-06550: line 18, column 3:
PL/SQL: Statement ignored
$[CHE_TEST@asterix1_impl] r
1 declare
2 cursor cData is
3 with data as (
4 select 1 id, 'test1' val1, 'a' val2 from dual
5 union all
6 select 1 id, '1test' val1, 'b' val2 from dual
7 union all
8 select 2 id, 'test2' val1, 'a' val2 from dual
9 union all
10 select 2 id, '2test' val1, 'b' val2 from dual
11 )
12 select a.id a_id, b.id b_id, a.val1 a_val1, b.val1 b_val1, a.val2 a_val2, b.val2 b_val2
13 from data a, data b
14 where a.id = b.id
15 and a.val2 = 'a'
16 and b.val2 = 'b';
17 begin
18 for rData in cData loop
19 null;
20 end loop;
21* end;
PL/SQL procedure successfully completed.
cheers -
Need to create a new row in table with same data as Primary key, but new PK
Hello Gurus ,
I have a table with one column as primary key, I need to create a new row in the table, but with same data as in one of the rows, but with different primary key, in short a duplicate row with diferent primary key ..
Any ideas of how it can be done without much complication?
Thanks in advance for your reply.
Reards,
Swapneel Kaleuser9970447 wrote:
Hello Gurus ,
I have a table with one column as primary key, I need to create a new row in the table, but with same data as in one of the rows, but with different primary key, in short a duplicate row with diferent primary key ..
Any ideas of how it can be done without much complication?
Thanks in advance for your reply.
Reards,
Swapneel Kalesomething like
insert into mytable values ('literal for new pk',
select non-pk-1,
non-pk-2,
non-pk-n
from mytable
where pk-col = 'literal for existing pk') -
Merging data from 2 schemas with same object structure into one schema
Hi
I want to merge data from 2 schemas in different environments ( say test1 and test 2) into 1 schema ( say Test_final) for testing. Both these schemas are having same structure, the data can be same or different.
What I did is that I took an export of schema on Test1 and then import it into Test_final. Now I need to merge/append data from Test2 into Test_final.
I can not merge the data with import due to primary key constraints and also import doesnt support this feature, so I tried SQL*Loader to "append" the data by using sequence to generate Primary key.
But my worries are that since new primary keys are generated so foreign keys will become invalidated and the data will not be consistent.
Is there any other way to do this task..
Regards
RamanThis approach might be better...
create table test_final
as
select *
from schema1.test1
insert into test_final
select t2.* from schema2.test1 , test_final tf
where t2.pk != tf.pk
/...assuming duplicate primary keys mean duplicate records. If that assumption is not the case then you have a more complex data migration exercise on your hands and you need to figure out some rules to determine which version of the data takes precedence.
Cheers, APC
Maybe you are looking for
-
How do you work with iTunes 10.6 and 10.7?
My G5 will not run 10.7 so if I update the powerbook running Lion then will the library on the G5 be able to sync to the iPhone? or will the libraries be incompatible? beyond that are there any unforseen castrophies which I have not thought of yet? T
-
How do I resolve issue of new version of itunes software not installing on my computer? I get error message when I start the install..
-
Hello, I have an eMac which I have updated to Tiger. I never had a problem before...now my computer freezes whenever it feels like it. I called Apple and did the utilities repair...I also reinstalled Tiger. I know that I do need to add some memory, b
-
I am passing a query to a cfc. When I dump the query in the cfc it looks fine. However, when I attempt to loop over the query I get the following error: Complex object types cannot be converted to simple values. The expression has requested a variabl
-
I don't want to cause my existing version to be overlayed.