Newbie question RE: Select common fields

I have to select all common jobs from the emp table that are in dept's 10,20,30. Do I need to do a self join? Subquery? Any help will be greatly appreciate.

I can think of a couple of ways off the top of my head:
SELECT job_id
FROM employees e
WHERE department_id = 10 and
      EXISTS (SELECT 1 FROM employees i
              WHERE e.job_id = i.job_id and
                    i.department_id = 20) and
      EXISTS (SELECT 1 FROM employees i
              WHERE e.job_id = i.job_id and
                    i.department_id = 30);
SELECT job_id FROM employees
WHERE department_id = 10
INTERSECT
SELECT job_id FROM employees
WHERE department_id = 20
INTERSECT
SELECT job_id FROM employees
WHERE department_id = 30nurhidayat:
You query will return the jobs that are in the three departments, not the "common jobs" from the three departments.
Devanand:
Your query is is incorrect, it will throw:
ORA-00979: not a GROUP BY expression
because you do not have department in the select list
TTFN
John

Similar Messages

  • Newbie question - parameter selection -- update the table - basic flow?

    Greetings
    Newbie here trying to work my way through a 'simple' example for a demo.
    I'm currently using a workspace on the Apex web site and have uploaded a table with seven (7) columns of which the first three (3) make up the primary key. This is a copy of an actual Production table so I can't change the PK setup.
    What I'm trying to develop as a demonstration of OAE is a Page 1 parameter form that allows the user to input any portion of any or all of the PK values, press the GO button and have Page 2 be a multi-row form showing the results based on the values input on Page 1 and having the user be able to update any of the remaining non-PK columns. After pressing an 'Apply Changes' button to perform the update the user will press a 'New Query' button and go back to Page 1 with the original values cleared out.
    It sounds pretty straight forward but I know the 3-column PK creates some headaches.
    What I'd like is some guidance on what types of pages I need to create and how to clear out the parameter values.
    I was able to create a page with the parameters on it and get them assigned to the session variables but was not able to create the 2nd page that would even just report on the data based on the input parameters.
    I don't need the user to be able to add or delete rows, just update existing ones to correct data values.
    I'm continuing to go through the documentation and manuals but a little nudge in the right direction would certainly help.
    Many thanks for sharing your experiences.
    -gary

    Hi Ben and any others who elect to reply:
    Thanks to your guidance I've made some good progress. I have been able to create a parameter form that will accept part or all of my three (3) PK columns and put those in session variables. a 'GO' button is pressed and the 2nd page comes up which is based on a SQL query using the session variables from the first page and displays multiple rows of data. It even shows the correct data!
    I also modified the non-PK column attributes to make them updatable, at least I can over-type what shows up.
    The issue I'm struggling with now is how to get the COMMIT to happen to the database. I have an 'APPLY CHANGES' button on my report page and I thought I was relating that to a simple 'COMMIT' PL/SQL page process, but nothing gets committed.
    Do I need to code a manual version of a multiple row update (MRU)?
    If so, how do I do that?
    If not, what basic piece of understanding am I missing?
    Many thanks for your help.
    -gary

  • Joining two tables having no common fields using one select query

    Hi Experts,
    How to join two tables which are NOT having any field in common using only one select query?
    Your help will be appreciated.
    Thank you.

    Identify a third table (or more tables) with common fields with your two tables, or change your question either removing JOIN or removing NO COMMON FIELDS, else you wont get many responses and will be left alone in outer space, as suggested by Thomas.
    If you acturally require what you written, better execute two select and merge the two internal tables merging every record from first table with every record of second table, til no more memory is available.
    Regards,
    Raymond

  • RV042G Newbie Questions

    I have the new Cisco RV042G router, and I have just a few "newbie questions" about it as I get started using it:
    The firmware on board is v4.2.1.02. Since this is a brand new router, is that the latest firmware?
    Under Time>DST Dates, what do I need to configure in there? I'm in the US, Central Time.
    I want to use Back to My Mac from iCloud (formerly MobileMe). Under the iCloud preferances pane on my Mac, it's saying: "Back to My Mac may be slow because NAT Port Mapping (NAT-PMP) or Universal Plug and Play (UPnP) is turned off on your router. Turn on NAT-PMP or UPnP." What should I enable on my router in order for Back to My Mac to better function?
    I'm using a VOIP phone on the network (only 1 device with a couple phones). Are there any QoS settings I should tweak for better performance of my VOIP phone? I did change the port the VOIP phone is connected to to High (instead of Normal) under Port Settings. Will this help boost performance?
    I also want to setup a VLAN on a port for guests to access the Internet, but not have any access to my personal network. Here's the steps I've done so far. Is this sufficient or is there anything else I need to do?
    I went to Setup>Network, enabled Multiple Subnets.
    I added 192.168.254.1/255.255.255.0 as a subnet.
    I went to Port Management>Port Setup, set the port I wanted to use (Port 4) to VLAN2.
    I went to Firewall>Access Rules, added two rules:
    Deny All Traffic from 192.168.254.0 to 192.168.1.0.
    Deny All Traffic from 192.168.1.0 to 192.168.1.0.
    Thanks everyone for your help!

    Easy.  just goto the DHCP field and fill in the Static DHCP fields.
    Assigning static IP addresses by adding devices from a list
    Click Show unknown MAC addresses. The IP & MAC binding list appears. If the web browser displays a message about the pop-up window, allow the blocked content.
    The devices are listed by the IP address and the MAC address. (Typically the MAC address appears on a label on the bottom panel or back panel of a device.) If needed, you can clickRefresh to update the data.To select a device, first enter a descriptive Name. Then check the Enable box. Alternatively, select all devices in the list by clicking the check box at the top of the Enable column.
    Click OK to add the devices to the Static IP list, or click Close to close the pop-up window without adding the selected devices. After you click OK, a message appears. The message includes important information. Read it before clicking OK. Keep the browser open and wait until the selected MAC addresses appear in the Static IP list.
    Modify or remove list entries, as needed:
    To modify the settings: Click a device in the list. The information appears in the text fields. Make the changes, and then click Update. If you do not need to make changes, you can click Add New to de-select the entry and clear the text fields.
    To delete an entry from the list: Click the entry that you want to delete, and then clickDelete. To select a block of entries, click the first entry, hold down the Shift key, and then click the final entry in the block. To select individual entries, press the Ctrl key while clicking each entry. To de-select an entry, press the Ctrl key while clicking the entry.
    Assigning static IP addresses by entering devices manuallyIn the Static IP Address section, add or edit entries as needed. Remember that the settings are not saved until you click the Save button.
    To add a new device to the list: Enter the following information, and then click Add to list.
    Static IP Address: Enter the static IP address. You can enter 0.0.0.0 if you want the router to assign a static IP address to the device.
    MAC Address: Enter the MAC address of the device. (Typically the MAC address appears on a label on the bottom panel or the back panel of a device.) Enter the address without punctuation.
    Name: Enter a descriptive name for the device.
    Enable: Check this box to assign the static IP address to this device.
    To add another new entry: Enter the information, and then click Add to list.
    To modify the settings: Click a device in the list. The information appears in the text fields. Make the changes, and then click Update. If you do not need to make changes, you can clickAdd New to de-select the entry and clear the text fields.
    To delete an entry from the list: Click the entry that you want to delete, and then click Delete. To select a block of entries, click the first entry, hold down the Shift key, and then click the final entry in the block. To select individual entries, press the Ctrl key while clicking each entry. To de-select an entry, press the Ctrl key while clicking the entry.
    Using the Static IP List to Block Devices
    You can use the Static IP list to control access to your network. You can block access by devices that are not on the list or do not have the correct IP address.
    Add devices to the Static IP list as described in Static IP Addresses.
    Enable or disable the following features:
    Block MAC address on the list with wrong IP address: Check this box to prevent a computer from accessing your network if its IP address has been changed. For example, if you previously assigned a static IP address of 192.168.1.100 and someone configures the device to use 192.168.149, the device will not be allowed to connect to your network. This feature discourages users from changing their device IP addresses without your permission. Uncheck the box to allow access regardless of the current IP address assignment.
    Block MAC address not on the list: Check this box to block access from devices that are not included in the Static IP list. This feature prevents unknown devices from accessing your network. Uncheck the box to allow access by any connected device that is configured with an IP address in the correct range.
    Hope that helps.
    Regards Simon
    http://www.linksysinfo.org

  • How to populate f4 values to standard pnp selection screen fields

    Hi Experts,
    my question is how to populate f4 values to standard pnp selection screen field. i am using LDB PNP for a report , it displays several fields with f4 values, i need to remove all the stadard f4 values and want to place my  f4 values in the selection screen

    Hi Venkat,
    To put ur own values in the F4 help of any field...all u have to do is.
    1st fetch all the records that u need to display in F4 help list...in one internal table.
    and then use the function module  'F4IF_INT_TABLE_VALUE_REQUEST'
    call function 'F4IF_INT_TABLE_VALUE_REQUEST'
    exporting
    retfield =
    value_org =
    tables
    value_tab =
    return_tab =
    exceptions
    parameter_error = 1
    no_values_found = 2
    others = 3.
    where retfield is the field for which u need to give the F4 help.
    and valu_tab is the internal table in which u have the list of records to be displayed.
    this would do the work...
    I dont have the system in front of me...as soon as i have...will try to send a piece of code, to make ur work easy.
    Till then hope this helps u...all the best
    Regards,
    Radhika

  • Question on selection-screen

    Hi,
    1) How we can provide two fields on selection-screen side by side
    2) How we can provide Text on selection-screen (ie some comments regarding selection-screen fields)

    Moderator message - Welcome to SCN
    However, this is not a training forum for ABAP. Please read the appropriate documentation.
    Thread locked..
    Please read [Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement], How to post code in SCN, and some things NOT to do... and [Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers] before posting again.

  • Disable the Select-options field in the viewcontainer

    Hi,
    I  have two select option fields(Date,Number) in a viewcontainer .
    Now i need to disable one of the select-option field(Date) in the view container based on the condition.If I give Enability for the view container then both the select options will get diasbled.Is there any way to disable only Date select-option field in the view container.
    Thanks in Advance.
    Regards,
    bala.

    Hi,
    I just tested this solution and it is working for me....Following on Thomas's suggestion...I did the following....
    I just had one select-option on my scr...but it can be done with two too...
    step1: 
    created three attributes at component level under the attribute tab ( as suggested by Thomas )
    ENABLE_PRI_SELECTOPTION type  WDY_BOOLEAN 
    M_HANDLER type ref to     IF_WD_SELECT_OPTIONS
    M_WD_SELECT_OPTIONS  type ref to     IWCI_WDR_SELECT_OPTIONS
    Note: all are with public check box checked....so that all your views can see these attributes
    I created a method at componenet controller leverl:  create_select_option....in this method i have following code:
    DATA:
      lt_range_table TYPE REF TO data,
    *  rt_range_table TYPE REF TO data,
      read_only TYPE abap_bool,
      typename TYPE string.
      DATA:
      lr_componentcontroller TYPE REF TO ig_componentcontroller,
      l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
    * create the used component
      l_ref_cmp_usage = wd_this->wd_cpuse_select_options( ).
      IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
        l_ref_cmp_usage->create_component( ).
      ENDIF.
    * get a pointer to the interface controller of the select options
    *component
      wd_this->m_wd_select_options = wd_this->wd_cpifc_select_options( ).
    * init the select screen
      wd_this->m_handler = wd_this->m_wd_select_options->init_selection_screen( ).
    * create a range table that consists of this new data element
      lt_range_table = wd_this->m_handler->create_range_table(
      i_typename = 'PERSNO' ).
    * add a new field to the selection
      wd_this->m_handler->add_selection_field(
      i_id = 'PERSNO'
    I_VALUE_HELP_TYPE = if_wd_value_help_handler=>CO_PREFIX_SEARCHHELP
    I_VALUE_HELP_ID = 'ZHELP_WDA_PERNR'
    I_NO_INTERVALS = abap_true
      it_result = lt_range_table
      i_read_only = wd_this->ENABLE_PRI_SELECTOPTION ).   <-----pls see here how i am controlling the read only property
    I assume you know this much...already....but i am just putting everything down....
    step2:
    in my view where i want to display the select-options....i added this code under my wddoinit method
    DATA lo_componentcontroller TYPE REF TO ig_componentcontroller .
    lo_componentcontroller =   wd_this->get_componentcontroller_ctr( ).
    lo_componentcontroller->ENABLE_PRI_SELECTOPTION = abap_false.    <--pls see initially we want this field to be open
      lo_componentcontroller->create_select_option(
    step3: 
    i did not have much logic to control the select option field so i added a button which if user presses the field become disable...
    under that button action method i added the following code:
    DATA lo_componentcontroller TYPE REF TO ig_componentcontroller .
    lo_componentcontroller =   wd_this->get_componentcontroller_ctr( ).
    lo_componentcontroller->ENABLE_PRI_SELECTOPTION = abap_true.
       "<---pls see here how i am changing the global *attribute which Thomas has suggested for controlling the "read only" attibute for the select-option field....you can put this under *your "if" statement....
    "this step is very important if you do not remove the field you will get the dump...since it will try to add the same field again
    "which produces dump from system....
    lo_componentcontroller->m_handler->REMOVE_SELECTION_SCREEN_ITEM(
    i_id = 'PERSNO' ).
    "now call the same method which we created at component level to create the select_options...
    lo_componentcontroller->create_select_option(
    that is all....it works great for me.....let us know if still have any questions....
    Thanks...
    AS...

  • Select options fields at FuBa

    How can I define select options fields as import paramter at Function Modules ?
    Because I intend to pass select options fields to a FM in order to implement the below shown
    code .
    FUNCTION xyz
    importing
    ID
    DESCRIPTION
    CHANGING
       REFERENCE(ZSC_INFO) TYPE  SC_INFO
    select * from  SC_INFO into corresponding fields of table ZSC_INFO
    where
    ID                       in    so_id      and
    DESCRIPTION    in    so_des      and
    ENDFUNCTION

    Hi,
    The question is not completely clear to me but if you want to use the value of the select option and use it as an import parameter in a function module then some tips can be:
    1. The value of the select option can be singles values or a range. Need to pick up the right values.
    2. The import parameter and the variable you want to use must be of the same type.
    DATA: tp_id TYPE <data type from the import parameter of the FM TEST>.
    tp_id = so_vkorg-low "select option vkorg, you can use so_vkorg-high also for single values
    CALL FM 'TEST'
      IMPORT
        ID = tp_id
      EXPORT
        DESCRIPTION = tp_description.
    I hope that this is what you are looking for.
    Best regards,
    Guido Koopmann

  • How to find out the common fields

    Hi all
    I want to pull out data from the following tables
    OPCH,PCH1,OCRD,OVPM
    Vendor Name OPCH
    GL Date PCH1
    Bill No PCH1
    Bill Date PCH1
    Due Date PCH1
    Bill Amount OPCH
    TDS PCH1
    Advance Adjusted OPCH
    Total Due OPCH
    Amount Paid OVPM
    Mode of payment OCRD
    Cheque/EFT  No OVPM
    How do i know which are the common fields ?
    Regards
    Farheen

    Hi,
    Are you looking for query like this :
    select t0.cardname as 'Vendor Name',
    t0.docnum as 'Bill Number', t1.docdate as 'Bill Date',
    t0.docduedate as 'Due Date',
    t0.doctotal as 'Bill Amount', t4.WTAmnt as 'TDS Amount',
    t0.dpmAppl as 'Advance Adjusted', (t0.doctotal - t0.paidtodate) as 'Total Balance Due',
    t3.sumapplied as 'Amount Paid', t5.checknum as 'Cheque No.' 
    from OPCH t0
    inner join PCH1 t1 on t0.docentry = t1.docentry
    left join PCH5 t4 on t4.absentry = t0.docentry
    left join OCRD t2 on t0.cardcode = t2.cardcode
    left join VPM2 t3 on t0.transid = t3.doctransid
    left join VPM1 t5 on t5.docnum = t3.docnum
    Kind Regards,
    Jitin
    SAP Business One Forum Team

  • Newbie question - XML version, searching by artist

    Probably quite a common problems - apologies for newbie questions.
    I've changed the URL of my MP3s in my XML to a new location and refreshed my feed. Is there a way of seeing what version of the XML iTunes is using? (it takes around 24 housr to refresh, right?)
    Also, when I'm searching for my podcast by author it's not coming up (<channel><itunes:author>) - is there a reason for this or a way to get it to show up when people search for the artist, other than doubling it in the title? (This works by the way, but I'd prefer not to!)
    Thanks.

    you can do it in just one loop, going through all the image
    tags in index_content and for each tag fill the values of all four
    arrays
    for (i...) {
    get the appropriate child of index_content
    first_array[ i ] = value of first tag
    second_array[ i ] = value of second tag
    no need for multiple loops.
    flash has functionality for xml files, but it helps to write
    a little wrapper around it, to simplify programming, especially if
    you work with xml a lot.. I wrote my for work, so I can't show it
    to you, but it's not very complicated to do

  • Question about the MAKZN field in the RBKP table

    Hello all.
    I have a question about the MAKZN field. Does anyone know what field in MIRO is assigned to this field? We have an issue where a line item amount was not selected invoice was out of balance but the agent selected accept and post. And invoice posted. but I am interested in knowing where the amount if keyed in because when I go to the RBKP table I see an amount entered in the MAKZN (manually accept net difference amount)

    Hi,
    it seems as if the value was calculated internally:
    program SAPLMR1M
    dynpro 6000
    PAI module fcode_6000
    Include LMR1MI3W
    *-------- buchen ------------------------------------------------------*
        WHEN fcobu OR fcomanak.
    *--- identical code in PAI Module FCODE_6250 --------------------------*
          PERFORM ota_check USING vf_kred-xcpdk rbkpv-xcpdd
                            CHANGING rc.
          IF rc NE 0.
            CLEAR ok-code.
            EXIT.
          ENDIF.
          IF ok-code = fcomanak.
            PERFORM diff_akzeptieren.
            ok-code = fcobu.
          ENDIF.
    where:
    fcomanak          LIKE ok-code VALUE 'MANAK', " Manuell akzeptiert
    *&      Form  DIFF_AKZEPTIEREN
    *       Differenz manuell akzeptieren
      FORM diff_akzeptieren.
    *       Manuell akzeptierter Betrag
        rbkpv-makzn  = rbkpv-makzn + rbkpv-diffn.
        rbkpv-makzmw = rbkpv-makzmw + rbkpv-diffmw.
    *       Differenzbeträge
        CLEAR: rbkpv-diffn, rbkpv-diffmw.
      ENDFORM.                             " DIFF_AKZEPTIEREN
    maybe it´s happenning when releasing manually the invoice in MRBR?
    Best regards.

  • Common field

    Hi All
    I have to enter the container number in the PO line item and it has to be there in inbound delivery.so my requuirement is to find out the common field in both the documents to enter the container numbr.
    Please guide me in this issue.
    regards
    chandra

    Sorry, I misunderstood your requirement. You need to join to facoa twice. Once to get the description for pur_type and again to get the description for prty_scode. Something like:
    SELECT a.compcode,b.descrip type_descrip, c.descrip scode_descrip, 
           pur_inv_no, pur_inv_dt, pur_num, pur_date, prty_scode,
           SUM((pur_amt - discount)+ bed_amt + sed_amt) value,
           SUM(stax_amt) stax_amt, SUM(pur_total) pur_total
    FROM fapurh a, facoa b, facoa c
    WHERE a.compcode = b.compcode and
          a.pur_type = b.scode and
          a.compcode = c.compcode and
          a.prty_scode = c.scode and
          stax_code = 'VAT05' and
          pur_date BETWEEN TO_DATE('01-apr-2005', 'dd-mon-yyyy') AND
                                   '30-apr-2005', 'dd-mon-yyyy') and
          pur_type <> 'JW0001'
    GROUP BY a.compcode, b.descrip, c.descrip, pur_inv_no, pur_inv_dt,
             pur_num, pur_date, prty_scodeHTH
    John

  • Newb Question for burning DVD/CDs

    I have an external DVD writer on my iMac.
    I got the thing last month and an completely new to Apple (sorta)
    Now how do I make a data CD and DVD?
    On Winblows XP all I need to do is select the files, right click and click on SEND FILES TO CD for making data CDs.
    However for DVD I need 3rd party software.
    Will iDVD do the trick?
    Thanks for the looking at this simple newb question.
    GeekyBoy

    Now how do I make a data CD and
    DVD?Drag the files to the icon of the
    blank CD/DVD that appears in the
    Finder.However for DVD I need 3rd party
    software.You might want to try Patc
    hBurn.Will iDVD do the
    trick?No, iDVD is only for making video
    DVDs and it requires a G4 processor.
    Thanks for the tip Duane.
    I was just reading abotu burning CD on another site. It mentions about what you said, drag the files to the CD.
    However I am reading in my profiler that burning is NOT supported by OS X on this CD/DVD writer.
    Will Patchburn or any other software overcome this?
    Thanks

  • InDesign or Acrobat (newbie question)

    Hi,
    I tried posting this in the LiveCycle Designer forum, but I think it's a bit too much of a newbie question:
    Once in a blue moon when I'm at work, someone will ask me if I can add text fields to a PDF form so that they can easily type onto it and print it out. I've always done that directly in Acrobat (on the few occasions that it's been requested from me). But I was curious about Adobe LiveCycle since it came with CS3, so I played around with it a couple of days ago. I added the text fields in LiveCycle this time, and it seems to have worked fine. Which is the better program for this kind of task? I'm not 100% clear on the *main* purposes of either program or how they compare. If anyone wanted to give me a clue about it, I'd appreciate it!
    Thanks,
    Phyllis

    > I thought perhaps you could add that capability
    You can (I said I was oversimplifying). However there are contractual
    limits - to oversimplify (!) 500 users per form.
    >Which would be preferable -- receiving form data from LiveCycle or Acrobat?
    It depends what you want to do.
    >
    >I wish I knew what the difference was between these two programs. Is it purely a matter of emphasis on one task or another?
    They come to the same problem in different ways. For a simple task
    they may seem pretty much the same. Some differences:
    * A form made in Acrobat is a PDF with form fields stuck on top; it
    remains a normal PDF in every other way. Forms are almost always made
    by preparing an existing PDF, then adding form fields.
    * A form made in Designer is barely a PDF. It's a wrapper round an XML
    file. You can no longer edit it in Acrobat, ever, even for the most
    simple things. PDF files are imported and converted (sometimes with
    loss of quality or features), or forms are made from scratch.
    * Acrobat form fields are fixed size.
    * Designer form layout can be dynamic.
    Aandi Inston

  • How to find common fields between two tables

    Hi friends,
    Is there any way to find out common fields between tables and linking the tables based on common fields.
    Thanks and Regards,
    Chitty.

    Hi Chitty,
      Try using joins it will give the fields which are only common to both the fields.
    Here s an example,
    SELECT mara~matnr
           marc~werks
    INTO   TABLE t_material
    FROM   mara AS mara INNER JOIN marc AS marc
    ON     maramatnr = marcmatnr
    WHERE  mara~mtart = p_mtart.
    Much Regards,
    Amuktha.

Maybe you are looking for