How to select all the people that are not in any equipe  ?

Hi,
I have a nice SQL expression that gives me as a result all the "AGENTS" (people) that are working in an EQUIPE (a team)
select a."AGENT_ID",
a."NOM" || ' ' || a."PRENOM" "Nom",
c.libelle "Equipe",
a."DATE_EMBAUCHE" "Date embauche",
a."DATE_DEBAUCHE" "Date débauche"
from OBSERVATOIRE."AGENT" a,
observatoire.equipe_agents b,
observatoire.equipe c
where a.agent_id = b.agent_id
and b.equipe_id = c.equipe_id
order by nom
Now, how to select all the agents that are NOT working in any "EQUIPE" (team) ?
I have tried but could not succeed !
Thank you for your kind help.
Christian

Christian from France wrote:
It is not working because the table EQUIPE_AGENTS does not contains a row if the agent is not into any equipe.
CREATE TABLE "OBSERVATOIRE"."EQUIPE_AGENTS"
(     "EQUIPE_AGENTS_ID" NUMBER NOT NULL ENABLE,
     "EQUIPE_ID" NUMBER NOT NULL ENABLE,
     "AGENT_ID" NUMBER NOT NULL ENABLE)
CREATE TABLE "OBSERVATOIRE"."AGENT"
(     "AGENT_ID" NUMBER NOT NULL ENABLE,
     "GRADES_ID" NUMBER NOT NULL ENABLE,
     "NOM" VARCHAR2(50 BYTE) NOT NULL ENABLE,
     "PRENOM" VARCHAR2(50 BYTE),
     "DATE_EMBAUCHE" DATE NOT NULL ENABLE,
     "DATE_DEBAUCHE" DATE)
The only way to "know" if an agent is not into any equipe (team) is to search into the EQUIPE_AGENTS table, and if we do not find the ID of the agent into this table, then we know that this agent is not into any EQUIPE (team).
I don't know ho to translate this into SQL.And that's what my query does. It uses an OUTER JOIN so that a result record is returned whether or not there is a record in EQUIPE_AGENTS. And the check for EQUIPE_ID is NULL restricts the result set to those where there IS NOT a record in EQUIPE_AGENTS.
A more traditional way would be to use NOT IN or NOT EXISTS clauses, but they can prove inefficient.

Similar Messages

  • How Can I delete all the tracks that are not in my Itunes Library?

    I am runnig out of disk space and i just want to have more space. My files are located everywhere on my mac and I saw that I have a lot of songs that are in my itunes music folder and the same are in an other folder. I want to keep everything that is in Itunes and delete the rest out of my mac!
    Thanks

    You can select some files in iTunes then right click consolidate.
    Then delete the original files not in the iTunes media folder.
    This way you don't have to do it all at once.
    Note that when you add files to iTunes, they are copied into the iTunes media folder so anything you added in the past is already in the iTunes media folder. Consolidating wont do anything to those. Likely all you need to do is delete the original.

  • How to display all the files that are selected using JFile chooser

    please hepl me i m posting my code here.
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import javax.swing.*;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.zip.Deflater;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipOutputStream;
    public class browser extends JFrame
    String curDir;
    JLabel statusbar;
    public browser()
    super("File Chooser Test Frame");
    setSize(1050,600);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    curDir = System.getProperty("user.dir") + File.separator;
    statusbar = new JLabel("Output of your button choice goes here!");
    Container c = getContentPane();
    c.setLayout( null );
    JButton openButton = new JButton("Browse file");
    JButton dirButton = new JButton("Pick Dir");
    JButton resetButton = new JButton("Reset");
    JButton submitButton = new JButton("Submit");
    final JTextArea tf = new JTextArea(100,50);
    final JList l1 = new JList("list");
    tf.setEditable(true);
    // add the open FILE chooser
    openButton.addActionListener(new ActionListener()
         public void actionPerformed(ActionEvent ae)
         JFileChooser chooser = new JFileChooser(curDir);
         chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
         chooser.setMultiSelectionEnabled(true);
    //Java 1.6 can use FileNameExtensionFilter class
    // FileFilter filter=new FileNameExtensionFilter("HTML file","htm","html")
    // chooser.addChoosableFileFilter(filter);
    //Prior versions must use external extension of FileFilter class (ie ExtFilter)
    //ExtFilter requires separate compile to enable choosable selection
         String[] html = new String[] {"htm","html","xhtml"};
         int option = chooser.showOpenDialog(browser.this);
         if (option == JFileChooser.APPROVE_OPTION)
         File[] sf = chooser.getSelectedFiles();
         String filelist = "nothing";
         try
         if (sf.length > 0) filelist = sf[0].getCanonicalPath();
         for (int i = 1; i < sf.length; i++)
         {filelist += ", " + sf[i].getCanonicalPath();
    tf.setText("our choices" + filelist);
         catch (IOException evt) {System.out.println("Exception: "+evt);}
    statusbar.setText("Your choices: " + filelist );
    // String[] text = new String[100];
    //getChars(0,100,text[],0);
    l1.setText("your choices \n" + filelist);
         else {statusbar.setText("You cancelled!");}
    // add the open DIRECTORY chooser
    dirButton.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent ae)
    JFileChooser chooser = new JFileChooser(curDir);
    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
         chooser.setMultiSelectionEnabled(false);
    int option = chooser.showOpenDialog(browser.this);
    if (option == JFileChooser.APPROVE_OPTION)
    File[] sf = chooser.getSelectedFiles();
    String filelist = "nothing";
    try
    if (sf.length > 0) filelist = sf[0].getCanonicalPath();
    for (int i = 1; i < sf.length; i++)
              {filelist += ", " + sf[i].getCanonicalPath();}
         catch (IOException evt) {System.out.println("Exception: "+evt);}
    statusbar.setText("You chose " + filelist);
         else {statusbar.setText("You cancelled!");}
    System.out.println("Example of ZIP file creation.");
    // Specify files to be zipped
    String[] filesToZip = new String[1];
    filesToZip[0] = "filelist";
    byte[] buffer = new byte[18024];
    // Specify zip file name
    String zipFileName = "example.zip";
    try {
    ZipOutputStream out =
    new ZipOutputStream(new FileOutputStream(zipFileName));
    // Set the compression ratio
    out.setLevel(Deflater.DEFAULT_COMPRESSION);
    // iterate through the array of files, adding each to the zip file
    for (int i = 0; i < filesToZip.length; i++) {
    System.out.println(i);
    // Associate a file input stream for the current file
    FileInputStream in = new FileInputStream(filesToZip);
    // Add ZIP entry to output stream.
    out.putNextEntry(new ZipEntry(filesToZip[i]));
    // Transfer bytes from the current file to the ZIP file
    //out.write(buffer, 0, in.read(buffer));
    int len;
    while ((len = in.read(buffer)) > 0)
    out.write(buffer, 0, len);
    // Close the current entry
    out.closeEntry();
    // Close the current file input stream
    in.close();
    // Close the ZipOutPutStream
    out.close();
    catch (IllegalArgumentException iae) {
    iae.printStackTrace();
    catch (FileNotFoundException fnfe) {
    fnfe.printStackTrace();
    catch (IOException ioe)
    ioe.printStackTrace();
    c.add(openButton);
    c.add(dirButton);
    c.add(statusbar);
    c.add(resetButton);
    c.add(submitButton);
    //c.add(tf);
    c.add(l1);
    Insets insets = c.getInsets();
    Dimension size = openButton.getPreferredSize();
    openButton.setBounds(745 + insets.left,115 + insets.top, size.width, size.height);
    size = dirButton.getPreferredSize();
    dirButton.setBounds(755 + insets.left,165 + insets.top, size.width, size.height);
    size = statusbar.getPreferredSize();
    statusbar.setBounds(755 + insets.left,215 + insets.top, size.width, size.height);
    size = resetButton.getPreferredSize();
    resetButton.setBounds(755 + insets.left,265 + insets.top, size.width, size.height);
    size = submitButton.getPreferredSize();
    submitButton.setBounds(755 + insets.left,465 + insets.top, size.width, size.height);
    size = tf.getPreferredSize();
    tf.setBounds(25 + insets.left,5 + insets.top, size.width + 150, size.height + 430);
    size = l1.getPreferredSize();
    l1.setBounds(25 + insets.left,5 + insets.top, size.width + 150, size.height + 430);
    setSize(1000,800);
    setVisible(true);
    public static void main(String[] args)
    new browser();

    Start by defining "display". Then continue by reading this:
    http://forum.java.sun.com/help.jspa?sec=formatting

  • I want to delete all the songs that are not in my playlists without having to delete them separately

    I have like 1500 songs and only want like 700 of them

    You can select some files in iTunes then right click consolidate.
    Then delete the original files not in the iTunes media folder.
    This way you don't have to do it all at once.
    Note that when you add files to iTunes, they are copied into the iTunes media folder so anything you added in the past is already in the iTunes media folder. Consolidating wont do anything to those. Likely all you need to do is delete the original.

  • All the SSIS Packages are not editable to the all users after deploying to the other server

    Hi All,
    I am using sqlserver2012.
    How to make all the SSIS Packages are not editable to all users after deploying to the other server. is there any way to achieve this,
    if yes, could share the information how to do....
    Thanks in advance....
    RamarajuC

    Typically, you change the protection level as listed in the following steps:
    During development, leave the protection level of packages set to the default value,
    EncryptSensitiveWithUserKey. This setting helps ensure that only the developer sees sensitive values in the package. Or, you can consider using
    EncryptAllWithUserKey, or DontSaveSensitive.
    When it is time to deploy the packages, you have to change the protection level to one that does not depend on the developer's user key. Therefore you typically have to select
    EncryptSensitiveWithPassword, or EncryptAllWithPassword. Encrypt the packages by assigning a temporary strong password that is also known to the operations team in the production environment.
    After the packages have been deployed to the production environment, the operations team can re-encrypt the deployed packages by assigning a strong password that is known only to them. Or, they can encrypt the deployed packages by selecting
    EncryptSensitiveWithUserKey or EncryptAllWithUserKey, and using the local credentials of the account that will run the packages.
    Please Mark This As Answer or vote for Helpful Post if this helps you to solve your question/problem. http://techequation.com

  • Program To Identify the BP that are not assigned to transactions.

    Hai guys,
    I want to identify ALl the BPs that are not assigned to any of the Transactions like Oppurtunities,Activities etc in our system,
    I can run report bu using the tables But000 and CRM_ORDERADM_H.
    Is there any easy way i.e a standard program in the system that does the work.

    Follow these steps to get the list of BP's assigned to transactions
    1. Copy the order GUID's from CRMD_ORDERADM_H
    2. go to table CRMD_LINK paste the copied order guid in place of GUID_HI and copy the GUID_SET.
    3.go to CRMD_PARTNER and paste the above copied CRMD_LINK GUID_SET in place of CRMD_PARTNER GUID and copy the PARTNER_NO
    4.Go to BUT000 paste the above copied CRMD_PARTNER PARTNER_NO in place of GUID and get the partner number.
    Hope this helps out.
    Thanks,
    Thirumala.

  • If i have one iPad and I want all the apps that are there how do I copy that so i can have them on another iPad the same way as i have them on the first iPad?

    if i have one iPad and I want all the apps that are there how do I copy that so i can have them on another iPad the same way as i have them on the first iPad?

    If you want both iPad to be identical .....
    Without connecting your iPad to your laptop, start iTunes. Go to iTunes>Preferences>Devices. Check the box next to "Prevent your iPod etc. from automatically syncing." Click OK.
    Now connect your iPad to your Mac and start iTunes.
    When iTunes starts, right click on your iPad under Devices in the left column. Select Transfer purchases.
    After it finishes transferring all your apps to the Mac, right click on your iPad and select Backup your iPad.
    Sync the iPad and eject it when it is complete.
    Quit iTunes
    Connect the second iPad.
    Launch iTunes
    Right click on the iPad name on the left side and select - Restore from Backup
    Select the backup of the first iPad and let it restore from that backup.
    When it finishes restoring - sync with iTunes to transfer all of the apps and any other content that you want onto that iPad
    Eject the iPad when you are done.
    Check the second iPad and if all of the content did not sync as you wanted - or you want to remove some of the content - connect it again and then choose the content that you want - uncheck what you do not want - and click on Apply in the lower right corner of iTunes.

  • My iMac holds my main iTunes account.  How do I find out a list of all the devices that are authorized from this computer?

    My iMac holds my main iTunes account and it shows 4 devices are authorized to play iTunes.  I can only name 3.  How do I find out a list of all the devices that are authorized from this computer?

    I don't believe this is possible, but you can deauthorize all your computers and start over if you are concerned.
    See here
    Best of luck

  • I understand that many versions of any pictures are still on my computer (Masters???).  If I have a final I like, how do I delete all the others that are taking up space?

    I understand that many versions of any pictures are still on my computer (Masters???).  If I have a final I like, how do I delete all the others that are taking up space?  I have already put the originals into albums, edited them, and renamed them.  Can I/should I delete all other versions located in Masters, I think?  If I want to keep events, but want them to include the newly edited albums, can I delete the specific event and somehow bring the photos used in the album into a new event.  Understand iPhoto just keeps space or manages photos, so how can I have events that include the edited pix and clean up disk space.  Thanks.
    iPhoto 11 v9.4.2
    using Lion, updated, on iMac Pro.

    It's very simple. If you want to use iPhoto, just let it manage things as it does. Other than that: Export from iPhoto and delete the image from iPhoto. That will remove the master and all versions.
    If space is an issue... use an external disk.
    Don't change anything in the iPhoto Library Folder via the Finder or any other application. iPhoto depends on the structure as well as the contents of this folder. Moving things, renaming things, deleting them or otherwise making changes will prevent iPhoto from working and could even cause you to damage or lose your photos.
    Regards
    TD

  • How do i delete all the photos that are in that Photo app?   it is eating up all my memory

    how do i delete all the photos that are in that Photo app?   it is eating up all my memory

    Photos transferred from your computer are removed from the iPhone the same way they were transferred from your computer, via the iTunes sync process. To remove all such photos, deselect Sync Photos under the Photos tab for your iPhone sync preferences with iTunes followed by a sync.
    Photos in your iPhone's Camera Roll can be imported by your computer as with any other digital camera followed by deleting the photos from the Camera Roll after the import process is complete.

  • How do I close all the apps that are still open?

    How do I close all the apps that are still open?

    You don't need to.
    The "task bar" that Demo mentions above is not, in fact, a task bar at all - it is the Recently Used Apps list. Not all of the apps in this list are open, running or in memory.
    iOS automatically handles closing apps that are not in use, so you don't have to manually manage them.
    Read this article from Apple for more information: http://support.apple.com/kb/HT4211

  • How can i delete all the emails that are downloaded on to my phone

    How can I delete the emails that are downloaded to my phone with out doing it one (or one page or so) at a time?

    You cant. Sorry

  • HT201317 How can i get all the photos that are in my photo stream on my mac onto my new iPhone?

    How do I get the photos that are in my photo stream on my mac in iphoto onto my iphone 5?

    By syncing them from your iphoto using that article
    iOS and iPod: Syncing photos using iTunes - Apple - Support
    Or if last 30 days of pictures is enough for you, you just need to sign in to your icloud on the phone and turn photostream "ON".

  • How do you change the fields that are displayed on the email preview list after a search?

    How do you modify the fields that are displayed in the mail preview list in the center column of Mac mail after you conduct a search of your email?   All of a sudden the displayed fields changed on me whenever I do a search in mail.   When I have not filtered my email with a search, the default field shown in bold at the top of each message's preview is the "From" field.   However, when I do a search this changes to the "To" field.   Can anyone help?   Thanks, ccarey

    ipicus
    But why would you want this?
    iTunes is responsible for the File Management, let it get on with it, you do your organisation in the iTunes window. And everything you need to do, you can do via the iTunes Window. Want to find the file of a track quickly? Right click on it in the iTunes Window and select Show File: A finder window pops open with the file already selected.
    Regards
    TD

  • How to select all the colomns_names from a table, with their datatypes ..

    hi :)
    i would like to know, how to select in SQL all the columns names from a table with their datatypes so that i get something like this :
    Table 1 : table_name
    the column ID has the Datatype NUMBER
    the column name has the Datatype Varchar2
    Table 2 : table_name
    the column check has the Datatype NUMBER
    the column air has the Datatype Varchar2
    and that has to be for all the tables that i own ! ..
    P. S : i m trying to do this with java, so it s would be enough if you just tell me how to select all the tables_names with all their colums_names and with all their datatypes ! ..
    thank you :)
    i ve heard it can be done with USER_TABLES .. but i have no idea how :( ..
    Edited by: user8865125 on 17.05.2011 12:22

    Hi,
    The data dictionary view USER_TAB_COLUMNS has one row for every column in every table in your schema. The columns TABLE_NAME, COLUMN_NAME and DATA_TYPE have all the information you need.
    Another data dictionary view, USER_TABLES, may be useful, too. It has one row pre table.

Maybe you are looking for