Search for value in the subset of data and returns a single line.

Hello

I wonder if you can help me with a query.

I want to return a single line of data below

where the Rno = 1 but also include a column to indicate a code of T555 tran was found in the subset (based on customer no)

I used an analytic function (row_number) to enter the data in the following order and wonder if there is something similar for helping me understand the transaction code.

Customer without Tran Code TranDate NWR

1 T345 01/01/2001 1

1 B455 01/01/1999 2

1 T555 01/01/1998 3

1 R433 01/01/1997 4

1 "T543" 01/01/1996 5

Thank you


SQL> with t
  2  as
  3  (
  4  select 1 client_no, 'T345' tran_code, to_date('01/01/2001', 'dd/mm/yyyy') trandate, 1 rno
  5    from dual union all
  6  select 1 client_no, 'B455' tran_code, to_date('01/01/1999', 'dd/mm/yyyy') trandate, 2 rno
  7    from dual union all
  8  select 1 client_no, 'T555' tran_code, to_date('01/01/1998', 'dd/mm/yyyy') trandate, 3 rno
  9    from dual union all
 10  select 1 client_no, 'R433' tran_code, to_date('01/01/1997', 'dd/mm/yyyy') trandate, 4 rno
 11    from dual union all
 12  select 1 client_no, 'T543' tran_code, to_date('01/01/1996', 'dd/mm/yyyy') trandate, 5 rno
 13    from dual
 14  )
 15  select client_no
 16       , tran_code
 17       , trandate
 18       , rno
 19       , case when t555_cnt > 0 then 'YES' else 'NO' end t555
 20    from (
 21            select t.*
 22                 , count(decode(tran_code, 'T555', 1)) over() t555_cnt
 23              from t
 24             where client_no = 1
 25         )
 26   where rno = 1;

 CLIENT_NO TRAN TRANDATE         RNO T55
---------- ---- --------- ---------- ---
         1 T345 01-JAN-01          1 YES

SQL>

Tags: Database

Similar Questions

  • Months of searching for numbers on the sheet

    Hello all and thanks in advance.

    I have tabs at the top. DATA (sheet 1), JAN (sheet 2), FEB (record 3), etc. until the end of the year.

    Data sheet will be the months on the left now I want care to go to the form to correct month and takes the total of the column relative to the other leaves and place in the correct cell line. (I've been copy paste, but I know there is an easier way to do this, so I turn to the people who know the numbers unlike my lack of knowledge.)

    On the leaves of the month, I would also like to highlight the line that are sat and Sun.

    Thanks again everyone for their help.

    Rich

    In the material master

    Hi, NN,.

    You will have a Table for each month. Each Table must have a different name. Your summary table lists more than 12 months, then I would say the table name from each month is named with the name of the month AND the year.

    The monthly tables may appear on separate sheets, or the same sheet. The key, as far as the formulae are concerned, is that each Table can be identified by its name.

    The following example includes only the table for April 2016, named "APR 2016", I assumed that the total line will be row 33 on each table of data collection, but wrote the formula to allow the placement of the line totals in other places. The lines for most of the actual days have been hidden and has not been designated, as these labels have no role in the operation of the formula.

    The TOTALS is defined as a footer line. The formula, in the columns showing a value is SUM (a) where 'a' is the letter of the column to be added. (The two values of zero have been entered manually for example).

    The table has a unique formula, entered in cell B3 and filled with right and until the last line for which there is a Table whose name corresponds to the label in column A. For example, the formula has been met only 3 online.

    B3: = INDEX (APRIL 2016: $A$ 1: $ 33, MATCH $N ("TOTALS", APRIL 2016: $A, 0), GAME ($ 1 B, APRIL 2016: $1: $1.0),)

    Syntax:

    INSTRUCTION (range,-l'index of the line, column-index, index of the surface)

    range: all of the cells in the source table

    the index of the line: the number of the start line to get the value. This is provided by the first statement of the GAME.

    the index of the column: the number of the column from which to get the value. This is provided by the second statement to MATCH.

    the index of the surface: omis. By default, 1. There is only 1 area of application of this INDEX, all of the source table.

    MATCH (image search-search for, - where - method)

    EQUIV function returns the position in the list of the search for value.

    First case:

    search for: TOTALS text

    search - where: column A of table source

    method): 0 means finding the exact value.

    Second case:

    search for: the text contained in the cell of line 1 of the specified column. That form is completed on the right, the increments of the column by one for each stage.

    search - where: line 1 of table source

    method): 0 means finding the exact value.

    The formula should be changed for each new line. Three references to "APR 2016" should be changed to match the name of the table to collect this row grand totals. Once edited in column A, the formula can be filled right and automatically adapts to his new position.

    Note: The duration value in column F of the table of the month wouldn't transfer and keep the same formula in column C of the summary table. Any attempt to restore the format to match your example resulted in a triangle of error.

    Kind regards

    Barry

  • Search for text in the option in Windows Search 4.0 Preview pane doesn't work do not

    I use XP SP3.  I recently downloaded Windows Search 4.0.

    When the Windows search results window opens, I noticed that it is possible to search for text in the preview pane.  I click on a file and go to OPTIONS > COMPONENT of VISUALIZATION, but see that FIND is grayed out and unavailable.

    This function worked before, when I loaded Windows Search first; now, it no longer works.  My files have been fully indexed; and I made no changes to the computer since then.  I tried to restart the computer, but there was no change.

    Any ideas? Matthew W. I. Dunn

    Hello Matthew w. I. Dunn, welcome.

    I recommend trying a system restore to see if that solves the problem. Try this:
    1. click on START
    2. click on "all programs".
    3. click on "Accessories".
    4. click on "system tools."
    5. click on "system restore."
    6 follow the prompts shown to restore your system to a date before the problem started. Although the system restore does not target the personal data, it is recommended that you back up all data such as music, photos and documents in case something is not bad.
    Let us know what happens
    Thank you!

    Ryan Thieman
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • 2014 CC Dreamweaver takes conditional text? Specifically, I can put all my tech in a location data and the output of the subsets of data (doc Admin against doc user versus doc Marketing) based on tags or other methods?

    CC of Dreamweaver takes conditional text? Specifically, can I put all of my tech data in a doc of DW and the output of the subsets of data (doc Admin against doc user versus doc Marketing) based on tags or other methods?

    I don't have any front-end text editor (such as FrameMaker) or I'd do it here. Dreamweaver can do this without complex workarounds or procedures not supported?

    Thank you very much.

    Mike the Newbie

    OK, that's fine. DW not conditionalization and I'll see if I can get what I need to do or find another approach.

    Thanks a lot for your help.

    Michael

  • If Google is my default search, can I go and change it if I want to do a search for GMaps; only the default is in the search drop-down list.

    If Google is my default search, can I go and change it if I want to do a search for GMaps; only the default is in the search drop-down list.
    So I have to change the default to Google Maps then back to Google to search for one.

    I have it! It's the topic: config "hiddenoneoffs" where the 3 elements of google, maps and mcafee have been included. There was no space between Google and maps. I put one in from Google Maps. She appeared in the first box-ff, but not sure about the search in the second time zone. I went back to the subject: one-offs. Safe search was shown with a space after Secure. I took out the space. Safe search arose in the 2nd single search box!
    Weird! This is contrary to how they show in the search parameters.
    Can I have messed that when Firefox has been reset all the search engines on an update, but I do not.
    Either incidentally, I tried to re-installation characteristic but the file comes down as a .dmg that I'm not familiar with and don't apparently is 8.0 to win because he couldn't open it. Thank you once again.

  • in previous versions of firefox (I'm currently on beta 6.0), you can search for updates of the add-on... This seems to be is no longer possible. Where can I get the latest updates for my Add-ons?

    I saw that you can right click on each module in the Add-ons Manager to search for an update on this specific point, but does not search the updates on the whole as before 4? (at least I remember in 3.x I could search for updates on the whole...)

    In the view of the modules, click on the symbol "gear" to the left of the search box.

  • How can I search for files on the Web in CC?

    How can I search for files on the Web in CC? I can't find a field or research action.

    Thank you

    Search the site of property to https://assets.adobe.com is coming.

    For now if you have a "ton of files" you are probably also using the synchronization file that comes with the creative Cloud desktop application. You can search the creative Cloud Files folder on your local computer using the Mac OS X Finder or Windows Explorer.

  • How to activate the search function.  I get no match found when I search for words on the scanned PDF document

    How to activate the search function.  I get no match found when I search for words on the scanned PDF document

    A scanned document is just an image; even if it contains text, it is not searchable.

    Put text in a scanned image available, you will need to perform the recognition of text (OCR), which can be made with Acrobat, but not the free player.

  • How we can search for files in the Webcenter 11.1.1.6 content?

    Hello

    I have a requirement for a client where they want to use the advanced search of the AAU to search for files (not articles).

    Version: Webcenter content 11.1.1.6

    Contribution using folder_g files

    I founded a model pre-built for searching for files. The name is COLLECTION_GET_SEARCH_FORM


    Here is an example of this model and it works

    http://euedocs.emersonprocess.co.UK/idcplg?IdcService=COLLECTION_GET_SEARCH_FORM

    When I try this service on my own content instance Webcenter, the model is loaded. But when I click on search, nothing happens.

    The drop-down lists containing ' Contains/pairing /...» "they are also not responsible.

    I did some research on the Support of Oracle and I created this article:

    Limits for fast searching of the Collaboration of records(1071778.1)

    https://support.Oracle.com/epmos/faces/UI/km/SearchDocDisplay.JSPX?returnToSrId= & srnum = & _afrLoop = 418199051953706 & type = c...

    I'm still stuck on this issue. What configurations are absent?

    Is someone can help me?

    Thank you very much.

    I contacted support. Here's the answer:

    Hello

    The feature you're looking for is something that is not currently present out-of-box.

    He used to work in the classic configuration only, the way back.

    And 11 g, classic layout no longer exists.

    This is a request for development with our development team.

    Bug 6488476 - INCLUDE "SEARCH FOLDER of HIERARCHY" AS SEARCH OPTION

    Thank you

    Fatima zahra

    Thank you SrinathMenon for your reply also.

  • Include the expected start Date and end Date for the management of SSHRC-Absence

    Is it possible to include the scheduled Start Date and end Date of project to SSHRC, management of absences with the type of leave is confirmed?

    Thanks in advance

    Hello

    In this case, you should disable the option the absence request, so that by default all sheets are confirmed and the user do not have to apply once leave as planned and then comply.

    You can see the id metalink - "How do I disable the State of Absence of R12 Absence Management Page [ID 786691.1]" to understand how to disable "Planned" option to request authorization for simple customization.

    It will be useful.

    Thank you
    Sanjay

  • Search for "end of the cell.

    Is it possible to find something, you are looking for a 'end of the cell' change?

    It seems to be the # but I can't do function.

    Any suggestions?

    Cordially Nina Storm

    Search for this

    \A\(.+\Z

    and replace with this

    $ 0)

    Note the a... Z quirk: as comments Peter times \Z and \z work to end of article. Rather unfortunately, in regards to the beginning of the article only uppercase variant works...

  • Do the photo album, date and time taken?

    Just downloaded all my iPhotos to Photos from the old to the new iMac. All the old photos transferred with the intact title (date and time). How to activate this in Photos? Added some new pictures for the first time to Photos and may not know how to make the title the date and time the photo was taken (without manually typing in the date and time).

    That s not a feature of Photos

    Users contributed scripts to perform these tasks - Script: batch changing the title to the Date of Capture -or http://www.oldtoadstutorials.net/No.P01.html

    LN

  • Hi, I installed an Alfred Workflow (see code below) that will mark all my mails as read. After you run it for a minute, the mail has crashed and I had to forcequit. However, now, when you open the Mail it crashes instantly, even after restart and repair o

    Hello

    I installed an Alfred Workflow (see code below) that will mark all my mails as read. After you run it for a minute, the mail has crashed and I had to forcequit. However, now, when you open the Mail it crashes instantly, even after restart and repair the permissions. I also used the Ctrl + C and CTRL-Z commands in the Terminal to leave the alfred_script, but nothing helped. I'm running out of ideas here, so I hope you could help me either reinstall the mail.app. I could always just switch to a different mail application, but it's kind of a last resort.

    Code:

    Tell application "Mail".

    Define allAccounts on each account name

    Repeat with currAccount in allAccounts

    the unreadMboxes value (each mailbox to the account currAccount the unread number is not 0)

    Repeat with currMbox in unreadMboxes

    (read status of each message to currMbox including the playback State is set to false) true value

    end repeat

    end repeat

    tell the end

    Any input would be greatly appreciated. Can post the report of crash on demand.

    Not sure that Alfred's, but it's just an Applescript script and it would not cause Mail to be planted.

    However, when running through all the messages, it is possible Mail database has been corrupted and it crashes because of this.

    I'll probably get anything out of the accident report, but others might.

    My first instinct would be to rebuild the mailbox. Because you can't do that with him crashing, you can simply delete the databases and it will rebuild them.

    Navigate to this folder:

    ~/Library/Mail/v3/MailData/

    You can either manually through the files, or copy the full path and paste it into go the folder in the menu go to the Finder.

    Remove the envelope Index files. Open Mail and see if it works well.

    If your library does not appear in your folder, hold down the Option key and select library in the menu go to in the Finder.

  • Use the project start Date and duration to calculate the end Date of project

    I'm trying to calculate the end date of the project in a report using the project end Date and time entered on the opportunity.
    For example, if the start date of the project filled an opportunity is 31/01/2009 and the length (integer) is entered on the opportunity is 5, the project end date is in the report must be 30/06/2009.

    I'm trying to TIMESTAMPADD forumaul allows you to add the duration (number of months) to the project start date
    This Fx works TIMESTAMPADD (SQL_TSI_MONTH, 12, '-used Custom Attributes ".) DATE_40)
    But if I try to replace the number twelve by the length (integer field) I get an error when you try to save: TIMESTAMPADD (SQL_TSI_MONTH, "-opportunity Custom Metrics".) S_INT_0, '-used custom attributes. DATE_40)

    Any ideas on how I can get this to work would be greatly appreciated.

    Hi, try this. It might solve your prioblem TIMESTAMPADD (SQL_TSI_MONTH, CAST (YOUR FIELD AS INTEGER), account. (' "Last modified")

    -John CRMIT

  • When I click on the 'Get' button in the app store for El Capitan, the beachball cursor rises and crashes the app store (not responding) in the force quit window...

    When I click on the 'Get' button in the app store for El Capitan, the beachball cursor rises and crashes the app store (not responding) in the force quit window...

    How can I fix it?

    Nevermind, I restarted the computer and it was fixed

Maybe you are looking for

  • No popup information with question

    It seems to be a problem to 9.0. When I try to log out of my site, there is a window that opens normally asking me if I don't know I want to close the session. Now at 9 this window does not appear, just text, and on a page with TEXT it does not see.

  • How to connect pc audio to TV 20WLT56B?

    I've always been using a versatile television screen for my pc fine, but recently he broke. So I ve replaced an old Toshiba 20wlt56b TV screen that connects the pc. Pc connection is fine, pc audio cable is properly plugged & sound works on screen, bu

  • backup/restore problems

    So, recently, my iPhone 6 had a lot of questions (most applications would be closed from the opening, I couldn't update apps, all the texts and iMessages disappeared, Messages turns uses a lot of storage despite the removal of all, etc.) and a person

  • I can't connect to my wireless network.

    I can't connect to my wireless network.I pressed the FN + F8 combination keys and a box will appear briefly on the screen then disaappears quickly.I don't have time to click on anything, and also a message said that I have no network connection. I di

  • Password, property

    Is there a way to get the password for 'managed' TestStand? Password, property Syntax User. Password Data type String Goal Specifies the password for the user. Remarks When you set this property, TestStand scrambles the password before storing it in