How not to show duplicate lines, based on a field
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0Hello
I have a query that looks like some scripts that did not stand on a given date compared to what ran the same day about a week ago. We want to include the start_datetime and the end_datetime but when I add it to the select statement, it evokes all instances of jobs that run several times during the day. Is it possible to exclude the extra lines based on the field of script_name?
SELECT instances.script_name,
instances.instance_name,
REGEXP_REPLACE(master.description,
chr(49814), -- em-dash
'-') description
--instances.start_datetime
FROM xxcar.xxcar_abat_instances Instances,
xxcar.xxcar_abatch_master Master
WHERE 1 = 1
AND TRUNC(start_datetime) = TRUNC(TO_DATE(:p_StartDate, 'YYYY/MM/DD HH24:MI:SS')) - (:p_NumOfWeeks * 7)
AND Instances.SCRIPT_NAME = Master.SCRIPT_NAME (+)
MINUS
SELECT script_name,
instance_name,
NULL
--NULL
FROM xxcar.xxcar_abat_instances
WHERE 1 = 1
AND TRUNC(start_datetime) = TRUNC(TO_DATE(:p_StartDate, 'YYYY/MM/DD HH24:MI:SS'))
LESS performs a set operation - remove lines from the first series that exactly match the second set.
When you add columns to the first series, you want a smaller filter - try a NOT IN multi-column:
To remove several courses, to regroup and get min/max
SELECT instances.script_name,
instances.instance_name,
REGEXP_REPLACE(master.description,
chr(49814), -- em-dash
'-') description,
min(instances.start_datetime) start_datetime,
min(instances.end_datetime) end_datetime
FROM xxcar.xxcar_abat_instances Instances,
xxcar.xxcar_abatch_master Master
WHERE 1 = 1
AND TRUNC(start_datetime) = TRUNC(TO_DATE(:p_StartDate, 'YYYY/MM/DD HH24:MI:SS')) - (:p_NumOfWeeks * 7)
AND Instances.SCRIPT_NAME = Master.SCRIPT_NAME (+)
AND (script_name, instance_name) NOT IN
( SELECT script_name,
instance_name
FROM xxcar.xxcar_abat_instances
WHERE 1 = 1
AND TRUNC(start_datetime) = TRUNC(TO_DATE(:p_StartDate, 'YYYY/MM/DD HH24:MI:SS'))
)
group by instances.script_name, instances.instance_name, master.description
You do not give the definitions of table and query schemas in him, therefore I don't test it.
Kind regards
David
Tags: Database
Similar Questions
-
SQL - remove duplicate lines based on date or another column column
Hello people, it is possible to select the last row by column for a query:
say that my query returns:
book_id, date, price
===========
19, 10-JAN-2012, 40
19, 16-MAY-2012, 35
18, 10-MAY-2012, 21
And I want him back
book_id, date, price
===========
19, 16-MAY-2012, 35
18, 10-MAY-2012, 21
In other words, book_id 19 appears twice at the beginning but I now come back to the last version of it (based on the date column) as well as all other lines that have no duplicates.
Is it possible to do?
Thank you very muchHello
Here's one way:
WITH got_r_num AS ( SELECT table_x.* , ROW_NUMBER () OVER ( PARTITION BY book_id ORDER BY dt DESC NULLS LAST ) AS r_num FROM table_x ) SELECT * -- or list all columns except r_num FROM got_r_num WHERE r_num = 1 ;
If the combination (book_id, dt) is unique, then you can also use the LAST aggregate function.
-
How to hide/show any attribute based on LOV?
I have a pages that have three attribute .This following-
1 - one is LOV
2 input text
3. also enter text
If I select a value of LOV I want to hide an input text. How to achieve
Thank you
Published by: ADFORCLE on July 12, 2011 09:09If your version of Jdeveloper is not 11.1.2 checkbox
http://www.Oracle.com/technetwork/developer-tools/jdev/listbindingvalue-088449.html>
In JDeveloper 11.1.1.x, an expression such as #{bindings. JobId.inputValue} returns the number of index internal list when JobId was a list binding. To get the real value of attribute JobId, you had to use #{bindings. JobId.attributeValue}. in JDeveloper 11.1.2 it is no longer necessary, the #{bindings. Expression JobId.inputValue} returns the value of the attribute corresponding to the index selected in the list of choices.
>Published by: M.Jabr on July 11, 2011 09:05
-
Dear members,
Lets assume that we have data as below:
I needed to write a query so that the result should be:Receipt number txn date Item Number com batch gain locator --------------------------------------------------------------------------------------------------------------- 134565 15/05/2011 710 230 20 L123 178907 20/05/2011 710 230 20 L123 253535 19/05/2011 710 450 70 L456 983636 05/05/2011 710 345 60 L721
Of the foregoing for 710 point, we have two numbers for which we same in the columns of data * 'batch com', gain, index *. So I need to write a query in such a way so that the data for the three columns if same should appear only once as stated above.Receipt number txn date Item Number com batch gain locator --------------------------------------------------------------------------------------------------------------- 134565 15/05/2011 710 230 20 L123 178907 20/05/2011 710 253535 19/05/2011 710 450 70 L456 983636 05/05/2011 710 345 60 L721
I don't get clues on how to do it.
Any ideas?
Thank you
SandeepYou can try like this,
Not tested!
SELECT reciept_number, txn_date, item_number, DECODE (rn, 1, com_batch) com_batch, DECODE (rn, 1, gain) gain, DECODE (rn, 1, LOCATOR) LOCATOR FROM (SELECT A.*, ROW_NUMBER () OVER (PARTITION BY item_number, com_batch, gain, LOCATOR ORDER BY txn_date) rn FROM table_name A)
G.
-
Remove the duplicate line based on master e-mail
Hello
I have a request below that displays the records in doubles because of the tips white space I like how ignore and get a single record.
Select
SEPARATE
MASTER_EMAIL "E-mail account"
"Name",
Last_name "Last Name."
Decode (company_name, NULL, Domain, company_name) "society."
JOB_FUNCTION "Title."
Ligne_adresse_1 "address."
"CITY."
"STATE."
'COUNTRY ', HE SAID.
"Zip, ZIP
PHONE_NUMBER "phone."
FAX_NUMBER "Fax."
CREATED_DATE "created Date."
FIELD,
MASTER_FLAG,
location_company_name
of master_email_users
where
MASTER_EMAIL AS ' [email protected] % %'
Thank you
Sudhir
What I feel is best to remove the white space in the data itself by refreshing the records where we have and making sure that no future records cannot have white space while getting inserted.
This helps us to avoid additional functions to use in recovery.
-
How can I update several lines based on the comparison of the fields table 1 and 2
I create the following SQL to test what I found a method to update the records where the fields below the game, but what ends up happening is that the update functions works the first time and then basically updates everything to null. I don't understand what I'm doing wrong. New to this.
UPDATE SLS_HDR B
DEFINE (B.ORD_DT, B.SHIP_ADD_CD, B.INV_ADD_CD, B.LOB, B.STATUS,
B.ORD_TYPE, B.HDR_ROUTE, B.PRICE_LIST, B.CUST_ORDER, B.REF_A, B.REF_B,
B.ORD_REF, B.ORD_DISC, B.SREP, B.SREP2, B.PLAN_DEL_DT, B.TXTA, B.TXTB,
B.INV_CONTACT, B.SHIP_CONTACT, B.SOLD_CONTACT, B.PAY_CONTACT, B.ORD_AMT, B.UPDATED_DT)
(SELECT =
A.ORD_DT, A.SHIP_ADD_CD, A.INV_ADD_CD, A.LOB, A.STATUS,
A.ORD_TYPE, A.HDR_ROUTE, A.PRICE_LIST, A.CUST_ORDER, A.REF_A, A.REF_B,
A.ORD_REF, A.ORD_DISC, A.SREP, A.SREP2, A.PLAN_DEL_DT, A.TXTA, A.TXTB,
A.INV_CONTACT, A.SHIP_CONTACT, A.SOLD_CONTACT, A.PAY_CONTACT, A.ORD_AMT, SYSDATE
Of
SLS_HDR_TEMP HAS
WHERE
A.FIN_COMP = B.FIN_COMP AND
A.LOG_COMP = B.LOG_COMP AND
A.ORD_NO = B.ORD_NO AND
A.TRANS_DT = B.TRANS_DT AND
A.BP_TYPE = B.BP_TYPE AND
A.STATUS <>B.STATUS);
Can someone advise?
Thank you
Published by: 903292 on December 19, 2011 13:15you don't have a where clause in your update so no-matched lines will be updated with null values
UPDATE SLS_HDR B SET ( B.ORD_DT, B.SHIP_ADD_CD, B.INV_ADD_CD, B.LOB, B.STATUS, B.ORD_TYPE, B.HDR_ROUTE, B.PRICE_LIST, B.CUST_ORDER, B.REF_A, B.REF_B, B.ORD_REF, B.ORD_DISC, B.SREP, B.SREP2, B.PLAN_DEL_DT, B.TXTA, B.TXTB, B.INV_CONTACT, B.SHIP_CONTACT, B.SOLD_CONTACT, B.PAY_CONTACT, B.ORD_AMT,B.UPDATED_DT ) = ( SELECT A.ORD_DT, A.SHIP_ADD_CD, A.INV_ADD_CD, A.LOB, A.STATUS, A.ORD_TYPE, A.HDR_ROUTE, A.PRICE_LIST, A.CUST_ORDER, A.REF_A, A.REF_B, A.ORD_REF, A.ORD_DISC, A.SREP, A.SREP2,A.PLAN_DEL_DT, A.TXTA, A.TXTB, A.INV_CONTACT, A.SHIP_CONTACT, A.SOLD_CONTACT,A.PAY_CONTACT, A.ORD_AMT, SYSDATE FROM SLS_HDR_TEMP A WHERE A.FIN_COMP = B.FIN_COMP AND A.LOG_COMP = B.LOG_COMP AND A.ORD_NO = B.ORD_NO AND A.TRANS_DT = B.TRANS_DT AND A.BP_TYPE = B.BP_TYPE AND A.STATUS= B.STATUS ) WHERE EXISTS ( select null from SLS_HDR_TEMP A WHERE A.FIN_COMP = B.FIN_COMP AND A.LOG_COMP = B.LOG_COMP AND A.ORD_NO = B.ORD_NO AND A.TRANS_DT = B.TRANS_DT AND A.BP_TYPE = B.BP_TYPE AND A.STATUS= B.STATUS )
OR using Merge
Merge into SLS_HDR B using SLS_HDR_TEMP A on (A.FIN_COMP = B.FIN_COMP AND A.LOG_COMP = B.LOG_COMP AND A.ORD_NO = B.ORD_NO AND A.TRANS_DT = B.TRANS_DT AND A.BP_TYPE = B.BP_TYPE AND A.STATUS= B.STATUS) when matched then update set (B.ORD_DT, B.SHIP_ADD_CD, B.INV_ADD_CD, B.LOB, B.STATUS, B.ORD_TYPE, B.HDR_ROUTE, B.PRICE_LIST, B.CUST_ORDER, B.REF_A, B.REF_B, B.ORD_REF, B.ORD_DISC, B.SREP, B.SREP2, B.PLAN_DEL_DT, B.TXTA, B.TXTB, B.INV_CONTACT, B.SHIP_CONTACT, B.SOLD_CONTACT, B.PAY_CONTACT, B.ORD_AMT,B.UPDATED_DT ) = (A.ORD_DT, A.SHIP_ADD_CD, A.INV_ADD_CD, A.LOB, A.STATUS, A.ORD_TYPE, A.HDR_ROUTE, A.PRICE_LIST, A.CUST_ORDER, A.REF_A, A.REF_B, A.ORD_REF, A.ORD_DISC, A.SREP, A.SREP2,A.PLAN_DEL_DT, A.TXTA, A.TXTB, A.INV_CONTACT, A.SHIP_CONTACT, A.SOLD_CONTACT,A.PAY_CONTACT, A.ORD_AMT, SYSDATE)
HTH...
Thank you
-
How to return to the line in the text field
I created a form with a text field, but by filling out the form, the words don't word wrap, but just go in a single line across the field to text box.
When can I format the text box for the return to the line?
TKS
Under the Options tab of the Properties dialog box, you can set the Multiline field.
-
Referring to the line in the text field
Hi, this is probably very simple, but I couldn't find anything in the net.
How can I take specific line of the text field. In my case, it will be number and I am planing to use parseInt. on this channel
example:
LINE1 = 001
Line2 = 002
line 3 = 003
....
I'm in position to take this "002" line2 in
Something like the following might work if the text is in a list with the new lines for each line... "tf" is the name of the instance of the TextField...
var stringArray:Array = String(tf.text).split("\r");
trace(stringArray[1]); -
How to create table selectable line or not based on the value of the line
Hello.
JDeveloper 11.1.1.2
Is it possible to make a selectable table row or not based on a value in the line.
That is to say. lets say that the row contains a Boolean LOCKED = TRUE.
This line should not be selectable.
A line whose value LOCKED = FALSE should be selectable.
/ ErikErik,
No particular reason to disable a selection of lines for a particular line? If I'm an end user, I would be clicking on the same line of thought again and again my mouse does not ;) (call me dumb :)). How do you differentiate this line (using inlineStyle / styleClass) based on the value of line? In addition, you can disable the other buttons when a row with a particular value is selected (so that the user knows that the selected line is not treatable).
Arun-
-
make a form to complete but its still showing red line and documents cannot be posted as me please how to fix?
]Hi Nithya,
Please specify what you're trying to do and what is the error you receive. If possible, share a screenshot of the error with the red lines.
In addition, please share the following details: -.
Version of Adobe Reader: -.
Version of the operating system (Windows/MAC): -.
Thank you
Tanvi
-
Mr President
When possible in Oracle Forms to insert a second line based on 1st row, so why not in the ADF?
The user just enter data in the Module of sales in one line of a Bill as below
and it is displayed in two rows in financial Module.like below how to proceed in the ADF.
You can see that invoice line contains the sales tax and the gross sales amounts, then it is posted to the financial Module above two lines.
How to make ADF
Respect of
What I realized, this is:
-You have a table in you screen.
-You call CreateInsert 2 times to create 2 rows at the same time.
-You will enter value in a specific column (c1) line1
Looking for the value that you entered in row1 can be completely copied in the same column (c1), but in line2. is this correct?
If so try to do the following:
1. in the table inputText (c1) column set autoSubmit = true and setValueChangeListener to a method in backbean
2. in the inputTextValueChangeListener method to write this code
public void inputTextValueChangeListener(ValueChangeEvent valueChangeEvent) { DCIteratorBinding tableIter = (DCIteratorBinding) BindingContext.getCurrent().getCurrentBindingsEntry().get("tableIteratorName");// write table iterator name from pageDef. for (int i = 0; i < tableIter.getViewObject().getEstimatedRowCount(); i++) { ViewRowImpl myRow = (ViewRowImpl) tableIter.getRowAtRangeIndex(i); EntityImpl entityImpl = myRow.getEntity(0); if (EntityImpl.STATUS_NEW == entityImpl.getEntityState()) { System.out.println("New row found"); myRow.setAttribute("AttributeName", valueChangeEvent.getNewValue());// write attribute name } } }
3 - Add inputText id in the partialTrigger table
4 - pageDef. Set of table iterator rangeSize = "-1".
-
How to query a line based on its rownum
Hi all
What is the best way to interrogate a line based on its rownum? Suppose I have the following query:
Ellen has rownum 1, Sundar 2 and so on. How can I do it if I just want to ask a line where Mozhe's name, which is rownum 3?select first_name from employees where rownum<5; FIRST_NAME -------------------- Ellen Sundar Mozhe David
Best regards
ValYou said:
>
According to its availability
>Is not calculate it? What do you mean by 'availability' in this context?
What you can do, is something like this:
select empno, ename from ( select empno, ename, rownum rn from ( select empno, ename from scott.emp order by ename ) where rownum <= 3 ) where rn = 3;
You need something to order by.
Then, you create an internal selection with this order by.
Then you select the inside where select rownum<=>=>
And then you select just one third.
So select the above gets you the third order of the employee by name. -
How can I show or hide a picture based on the size of the screen in CS6?
I have a website created using Dreamweaver CS6. I used the checkerboard to fluid to hold different views for each of the 3 types - phone, Tablet, desktop computer. It works well, resizes properly. I would like to be able to show a picture in the desktop version but not the mobile version. How I do that? I can see in the .css file that the screens of different size can have their own different settings. Y at - it code I could add that could hide/show and image based on the users on the same page window? Let's say I have a div that is named photo. How could I add a parameter to the div photo in the stylesheet that would hide the image if it were mobile?
Thank you
Marilyn
Thanks, I was able to change my code using your example and it works exactly as I wanted!
-
Vista Ultimate 64-bit
How to get disabled login user (without password) at startup, so NOT to SHOW it to all (and needed clicked) and so after the switch, go to desktop directly?
Also after inactivity, how to not go to sleep mode and press "power on" to bring back?
Hello
If you want to start directly on the desktop?
How to automatically connect at startup in Vista
http://www.Vistax64.com/tutorials/66966-logon-automatically.htmlOr
How to make Vista require a user name and password when connecting
http://www.Vistax64.com/tutorials/89812-logon-username-password.html=========================================
Start - Control Panel - Power Options - upper left - require a password on wake up
tick her do not require a password - save the changes.I hope this helps.
Rob Brown - MS MVP - Windows Desktop Experience: Bike - Mark Twain said it right.
-
I try to install hearing CC 2015 but it not only shows the installation. It says 0% and its been 2 hours already. How can I solve this?
Please read https://forums.adobe.com/thread/1499014
-try some steps such as changing browsers and disable your firewall
-also clear the cache of your browser if you start with a fresh browser
-check the file hosts for blocked entries https://forums.adobe.com/thread/1912777
http://myleniumerrors.com/installation-and-licensing-problems/creative-cloud-error-codes-w ip.
https://helpx.Adobe.com/creative-cloud/KB/creative-cloud-desktop-application-failed.html
http://helpx.Adobe.com/creative-cloud/KB/failed-install-creative-cloud-desktop.html
Maybe you are looking for
-
How to remove the front rear of the Tecra S1 PT831A to check cable and power?
Hello I need to "check the cables and power," following the Seatools for test back and start-up message 'failure to support, check cable PXE - E61'. I also have a message for the CHKDSK using the XP Pro CD, saying after 26% that "the volumn appears t
-
The arrow back to Safari is possible to go to the page wherever you were immediately instead of everywhere where he pleases?
-
Setup Automatic ISATAP #28
My computer automatically installed ISATAP #28 on 30/01/12, cam, you tell me what it is, please, regards Bob Holehouse, * address email is removed from the privacy *
-
I have no windowsinstaller 3.1 and when I try to download that I can not install either get error messages and to send to microsoft / close window Impossible to download whatever it is and the other software does not not need help as soon as possible
-
I searched the web and have found nothing so far that can define it. Anyone know what is this file?