Including the field indicator

I have a similar following the requirment


Select * from emp where deptno = 10

List 3 lines

I want to include a DEPT_IND indicator with values of "Y" or "n" for these 7 rows.
DEPT_IND is set to 'Y' when the line returned by the above query has an enrty for the deptno = 20 condition in the emp table.


How can I include in the query

examples of data table.
emp

empno ename deptno
121     xxx     10
121     xxx     20
123     yyy     10     
124     zzz     10

I should get the o/p as

empno ename DEPT_IND
121    xxx     Y        
123    yyy     N
124    zzz     N
Thanks for your help.

Hena.
SELECT   e1.empno,
         e1.ename,
         NVL ( (SELECT   'Y'
                FROM     emp e2
                WHERE    e2.deptno = 20
                     AND e2.ename = e1.ename
                     AND e2.empno = e1.empno
                     AND ROWNUM = 1), 'N')
           dept_ind
FROM     emp e1
WHERE    e1.deptno = 10

Published by: Beijing on August 5, 2009 14:25

Published by: Beijing on August 5, 2009 14:26

Tags: Database

Similar Questions

  • How can I customize the template of Contacts to include the fields of my choice?

    I have my contacts in an excel file and intend to import contacts into a CSV file. No problem. But Contacts model uses a lot of fields I don't need (such as Pager) and I see no way to customize more compared to what I need.  I want change, not the mapping of the fields to the options in the default template. In Contacts, in the view drop-down list, choose the folder to view the details. The selection becomes a column header and can be used as a filter. It seems to be more than 100 selections.  How to use these matach to a field in the Contact model? Example: 'Product name' is one of the details (column header) I choose, but there is no corresponding information in the Contact model, 'Product name' isn't one of the choices when mapping fields during import.

    Wrong forum.
    Ask here:
    http://answers.Microsoft.com/en-us/Office/Forum/Excel

  • Why the MAX aggregate function is used in SQL upon accession of the fields created in the designer?

    Of course Certified Developer, you can see the left join to include the fields in the SU_EXTENTION_DATA table. Why MAX is used when retrieving these values?

    ! Wont start-

    LEFT JOIN

    (SELECT

    REF_NO "REF."

    MAX (CASE WHEN EXTENSION_FIELD_REF = 500033 THEN VALUE_DATE END) "DOB",.

    MAX (CASE WHEN EXTENSION_FIELD_REF = VALUE_STRING END THEN 500034) "E_CONTACT."

    MAX (CASE WHEN EXTENSION_FIELD_REF = 500035 THEN VALUE_STRING END) "E_CONT_NO."

    MAX (CASE WHEN EXTENSION_FIELD_REF = 500036 THEN VALUE_TEXT END) "MED_HIST."

    MAX (CASE WHEN EXTENSION_FIELD_REF = 500037 THEN SELECT_TEXT END) 'PREF_CONTACT '.

    OF SU_EXTENSION_DATA

    LEFT JOIN SU_SELECT_VALUES ON

    SU_EXTENSION_DATA. VALUE_SELECT = SU_SELECT_VALUES. REF

    WHERE CORE_ENTITY = 5

    REF_NO GROUP) X ON AR_PERSON. REF = X.REF

    ! End custom-

    When you do you must include all the fields that have been selected as criteria for grouping the aggregation OR use false features like MAX (more likely it's easier way when the result field is expression).

  • Why watch icon in the url field indicating the availability of RSS is more?

    Why the RSS icon indicating RSS availability is more watch outside the field of URL in Firefox when I know that the feature should be available on the site? He appears in Seamonkey to the same site. Sign me in Firefox, but I can't.

    Under Linux, it is "Firefox > Preferences > toolbars" or if you have the menu bar "view > toolbars > customize.

  • the fitting of the image in the field including AutoFit options are not displayed on my options panel of the selections Tools toolbar

    The fitting of the image in the field including AutoFit options are not displayed on my options panel to toolbar for the selection tools. How can I view?

    You're out of space. Some toolbar has been resized/re-spaced in the last update. Click on the menu button (on the far-right in your screenshot) and select Customize... Make sure that the mounting frame (object) is selected. If this is the case, you should disable something else to make room for this group of button.

    Furthermore, I see that your application window is not maximized. What happens if you expand to the maximum it?

  • client's request to include the address fields

    Can someone help me develop this query...


    SELECT arps.org_id, hzp.party_name client_name, HCA.account_number customer_number, -rat.NAME term_name, Arps.invoice_currency_code, SUM (arps.amount_due_remaining) outstandaing_amt


    FROM - apps.hz_cust_profile_amts, hcpa -apps.hz_customer_profiles hcp, apps.hz_cust_accounts_all AOB, apps.hz_cust_acct_sites_all AHC, hcsu, apps.hz_cust_site_uses_all apps.hz_parties hzp, -rat ra_terms_tl,

    ar_payment_schedules_all ARP


    WHERE 1 = 1

    - AND hca.cust_account_id = hcp.cust_account_id

    - AND hca.cust_account_id = hcpa.cust_account_id

    AND hca.cust_account_id = hcas.cust_account_id

    AND hcas.cust_acct_site_id = hcsu.cust_acct_site_id

    AND hcsu.site_use_code = 'address '.

    AND hcsu.status = 'A '.

    - AND hcpa.site_use_id IS NULL

    - AND hcp.site_use_id IS NULL

    - AND hcpa.overall_credit_limit <>0

    AND arps.payment_schedule_id > 0

    AND arps.amount_due_remaining <>0

    AND hzp.party_id = hca.party_id

    - AND hcsu.payment_term_id = rat.term_id

    AND hca.cust_account_id = arps.customer_id

    AND arps.status = 'OP '.


    Hca.account_number, GROUP hzp.party_name, Arps.invoice_currency_code, -rat.NAME, Arps.org_id

    -hcpa.overall_credit_limit


    To include the address fields in hz_locations (Address1, 2, 3, 4, and postal code). I can't see how the links / foreign keys etc.).

    You can use the link below

    hz_locations hl - customer address

    hz_party_sites hps

    hz_parties hzp

    hzp.party_id = HPS.party_id

    HPS.location_id = hl.location_id

    http://appsr12help.blogspot.com/2012/12/query-to-list-customer-party-account.html

  • I need to create a PDf form with specific editable fields, including the ability to insert an electronic signature and to be able to save the completed form. What version of adobe supports this?

    I need to create a PDF form with specific editable fields, including the ability to insert an electronic signature and to be able to save the completed form. What version of adobe supports this?

    subscription dc Acrobat or purchase, Plans and prices | Adobe Acrobat DC

  • Include all the fields in a global rule

    Hi all

    Anyone know if it is possible to set a global rule that includes all fields without having to manually add all alone in the rule? In this way, if a new metadata field is created, it is automatically applied to this general rule.

    The reason I ask because I want to hide all fields default and based on the user role grant/make available specific areas which should be visible to the user. I know that I can create a profile that serves this purpose by checking the option "Exclude fields no-rules", but then that leaves the search Option open with each field metadata Standard. This would actually be a good option if there was a simple way to hide the standard search option.

    Thank you!

    Jorge

    Something like that in fact secondary rule overall tab should work.

    <$loadDocMetaDefinition()$>
    <$loop docmetadefinition$="">
    <$dpPromote(#active.dName &="" ":ishidden","1")$="">
    <$endloop$>

    This will strip everything you have added custom and just let the standard title, the sg, the account, release date, expiration date, etc.

    YMMV

  • Validate the signature of the field Signature

    I gave up.  I checked all the various discussions on this and I can't make it work!  Here is my code.

    What I am doing wrong !  Please help

    var oDoc = event.target;

    oState var = event.target.getField("Main.DeptHeadApproval").signatureValidate ();

    {If (oState == 0)

    {messagetext = messagetext + "head \tDirector/Department Approval\n";

    ErrorCount = + 1 errorcount ;}

    If (errorcount == 0)

    {OfficeUse.presence = "visible";

    oDoc.mailDoc({)

    bUI: true,

            cTo: " [email protected] ", "

    cCc: UserEmail.rawValue + ";" + DeptHeadEmail.rawValue,.

    bassujetti: 'YCAD risk User Set Up. "

    CSMG:

    });}

    else {xfa.host.messageBox ("Missing the required field (s): \n" + messagetext) ;}}}

    getField argument must be the full path to the signature field, including explicit instance indices, for example ".page1 form1 [0] [0]." Hand [0]. "DeptHeadApproval [0].

  • Display value instead of the key into the field with LOV?

    Sorry, that's so basic I don't know it should be easy, but somehow, I can't find it in the documentation. The LOCATION table contains a foreign key referencing the table of CLIMATE. As well as its primary key, CLIMATE has a column called NAME that contains the name of the climate (e.g., temperate, tropical, etc.). The user must be able to update the value of climate for the location, is working on that. I have a list of values that has air up the names of possible climates, the user selects the name he wants so set in the LOCATION table. It works, but the problem is that the input element shows the value of key for the record of CLIMATE, and I need to display the value of NAME instead. Of course, I have another field indicating the name, but that is a mess, the user does not include the value of the key and should not have to see. So, how can I make an entry field display NAME, updating really of the value of the key to the LOV choice?

    Thank you

    Hello

    You can try something like this:




    ......
    ......
    ......>


    ......
    ......
    ......>


    Hope this helps

    Joseba

  • How can I find the field 'Other' in my Thunderbird contacts?

    I imported my Yahoo contacts into Thunderbird. All my keywords were in the 'Notes' field in Yahoo. After import in Thunderbird, it ended up in the field 'other '.

    When I go into the search tool, it lists all of the searchable fields. 'Other' is not included. Is it possible to search for 'other '? Or is it possible to import the contacts in a way that lands the Yahoo 'Notes' in a searchable field?

    Thank you!

    I think it's this add-on you want to https://nic-nac-project.org/~kaosmos/morecols-en.html

  • F2 and entry does not on certain pages of the site, except if the field selected

    F2 and entry does not not to go backward or forward on certain pages of the site unless field selected. It is on an intranet site after reload PC with Windows XP, other old Windows XP PC work.

    Including the Firefox Firefox 10.0, or 11.0 9.0 upgrade fixed this problem with the program code of the intranet for keys F2 and Enter to forward and back a page in the application of the intranet site.

  • I accidentally entered my password in the field 'user ID' a website connection, and pre-populating it now appear in the list of suggestions for that field. Is there a way to make the pre-fill 'forget' a specific entry?

    While connecting to a secure Web site, I was typing too fast and accidentally included my password in the field ID used while connection and press enter before I realized my mistake. I then connected properly, but now Firefox include this false entry (with another entry accidentally misspelled) in the list of suggestions of pre-filling every time I go to this page. I prefer not to cut completely from pre-filling, but obviously I don't want my password to be specified. Can I delete the wrong entry in the list of suggestions as pre-filling watch somehow? (I use Firefox 6.0 on Windows 7)

    Select the entry in the drop-down menu and press "DELETE", Mac users, press 'Shift + Delete '.

  • Looking for a compatible printer AirPrint for use in the field to print from my iPad 2. Possess and have v

    Looking for a compatible printer AirPrint for use in the field to print from my iPad 2. Own and use very satisfactory wbt 460 HP with a laptop. All compatible printers AirPrint currently all-in-one and too big for travel or field use.

    Whereas several HP printers are among the 15 AirPrints currently on the market, it seems reasonable that HP could provide the upgrade that would make my 460 AirPrint compatible wbt.

    I wireless (my fi) and would like to buy the wireless card from the blue tooth, if only the upgrade of the driver was available.

    How and when HP can provide a mobile/trip AirPrint printer?

    Answer as I am a person of 70 years. Because I am and can be quickly way over my head!

    For now, we don't have an Airprint-compatible printer. Future products may include, but are not currently. Products that are compatible Airprint are designed this way, so no upgrade will take place for previous models.

  • get the warning "indicator of battery - HPID09

    HP Pavilion Slimline,

    Model s5830a, Prod # VT573AA-ABG

    Two battery indicator - HPID09 warnings appear as windows 7 does

    Access violation at address 74721A3B in module ' HID. DLL'.  Read of address 016360 has 8.

    Access violation at address 00401C in module 62 ' BATINDICATOR. Read of address 000002DC EXE

    What do these?

    There is only one battery in your slimline PC. It is the CR2032 battery used CMOS's BIOS to the chip. Replace the battery. You can buy one at any pharmacy.  If a PC is more than two years, that it is a fairly common fault.

    Here is a link to information about your installed moterboard that is complete with images, including the arrangement of the components on the motherboard.

    Batt + is the CR2032 battery.

    Best regards

    ERICO

Maybe you are looking for