Need to filter the data

Version of Oracle, Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production

Hi gurus

I have the following data samples:

Examples of data

Select * from EMP;

As with a REFERENCE

(

Select EMPNO 10, 100 DEPTNO, 'A' DOUBLE Categ

Union of all the

Select EMPNO 11, 100 DEPTNO, 'B' DOUBLE

Union of all the

Select 12 EMPNO, 100 DEPTNO, the DOUBLE ' C'

Union of all the

Select EMPNO 21, 200 DEPTNO, would be "of the DOUBLE

Union of all the

Select EMPNO 22, 200 DEPTNO, the DOUBLE "E"

Union of all the

Select EMPNO 23, 200 DEPTNO, 'F' of the DOUBLE

)

Select * reference

order by 2;

The query result

EMPNO, DEPTNO, CATEG

10 100 A

11 100 B

12 100 C

21 200 D

22 200 E

23 200 F

Required result

EMPNO, DEPTNO, CATEG

10 100 A

11 100 B

12 100 C

21 200 D

Rules

I want to select all the data of deptno 100 but for deptno 200, I want only Categ = D...

Is it possible to get this result using a where clause. I also got the result with the union, but I don't want the Union. Thanks in advance...

Concerning

Shu

Can be

Select *.

reference

where (deptno<>200 or (deptno = 200 and categ = has '))

Tags: Database

Similar Questions

  • Could not initialize and I need to recover the data on the hard drive.

    Original title: computer MOM will not start and I need to recover the data on the hard drive.

    It's an old computer and I do not know what version of Windows it was running.  I guess I need a bootdisk of exploitation, but where can I download that?  Or would it be easier to pull and make a secondary drive in my computer that I just replaced?  It works under Windows XP.

    Hello

    If the old system does not start could be the hard drive. Put the hard drive in another computer as a 2nd drive and then access the files. If you use a computer XP, Vista or Windows 7, you should be able to access the files, unless the drive has failed.

    You can save your files by putting the drive in another computer as a 2nd drive (better) or a USB external drive case and then save up to removable media such as CD, DVD or other USB drives. Of course a real store of the computer or the manufacturer of your system can help to recover the files.

    Or you can use a boot Ubuntu CD to back up data. (This will not work if the hard disk is defective or other issues preventing the system from booting from the CD/DVD drive.)

    Use Ubuntu Live CD to backup files from your Windows computer dead
    http://www.howtogeek.com/HOWTO/Windows-Vista/use-Ubuntu-Live-CD-to-backup-files-from-your-dead-Windows-computer

    I hope this helps.
    --------------------------------------------------------------------------------------------
    Rob Brown - Microsoft MVP<- profile="" -="" windows="" and="" devices="" for="" it :="" bicycle="" -="" mark="" twain="" said="" it="">

  • Need to reset the date and time

    My system has decided that it is Jan.4th 2004 and everytime I turn it on, I need to reset the date and time. How can I cure this?

    Packard Bell's Web site does not recognize the 'ALT' CO2 as a model.  Despite this, however, PB seems only to provide a 'generic user guide"which is not described the replacement of the motherboard or the battery at all.  In fact, the only thing he has to say about batteries is be careful how get rid you of them.

    Your computer is a laptop or Desktop/Tower computer?

    If you have a desktop/Tower computer, you can look here--> http://www.uktsupport.co.uk/pb/mb/pbmb.htm and see if you can identify the motherboard used in your computer.

    However, if you have a desktop/Tower computer, the best thing to do is to unplug your computer from the network and, taking the precautions perfectly static electricity, open the box and inspect the motherboard yourself.

    A newish mother on the above site, http://www.uktsupport.co.uk/pb/mb/cosmos.htm, shows the battery on the center line vertical and more to the left.  It's just below the 3 PCI slots.  If you have something like that, a Visual inspection should be enough to see how to remove it.  The type of battery will be engraved on the top of the battery.  In the photo, it looks like a model CR-2032, but there are several models of battery on this size.  Battery CR-2032 (or equivalent) is available in almost every pharmacy chain in the United States as well as online and stores like Radio Shack.

    The page for an old motherboard, http://www.uktsupport.co.uk/pb/mb/450.htm, indicates that the battery is a '3.0V DC Lithium soldered to the motherboard"and if that were the case, it would probably be something that you wouldn't do yourself.  However, this thread is to think that all you have to do for this particular mobo is actually finding the right type of support plug-and - battery.

    If you have a laptop, things can get quite a bit more difficult.  If you can find a different model for your computer name, you may be able to find the manual here--> http://tim.id.au/laptops/packardbell/ , but some of these manuals can not explain clearly how to get to the CMOS battery.

  • I need to allow the data controllers audio multi media that I need to find out how to access services running on your computer, I need to allow for this program and also Windows media center point final

    I need to allow the data controllers audio multi media that I need to know how to get to ser

    I need services running on your computer allow this program and also Windows media center point final. OK here is the problem have no sound on my computer, it says drivers are not installed, it indicates one or more programs need to be activated. It is said window media center end point should be activated. It is said he can not activate because no driver I have download the drivers yesterday and he always says the same thing, I have problems in trying to solve this problem, but don't know how I need help ok it tells me that there is no driver for my multimedia audio controllers. I have download then and he says the same thing, he repeats to me also to activate the multimedia audio controllers, I need to know how to get to the program that has all the services of the computer, so I can allow these things that need to be activated I do not know how attend you this program thank you for your help.

    The following articles can help me.

    http://www.ehow.com/how_6533261_install-multimedia-audio-controller.html

    http://www.TomsHardware.com/Forum/57964-3-enable-multimedia-audio-controller

  • need to update the date of the end of the user using the API of the IOM

    We have a requirement where we need to update the date of the end of the user. The details of the user as usr_key, number of days to extend (such as 30 days or 60 days), and affects manager is provided by SOA (maybe by BPEL). In the java class, I need to add the number of days of the closing date of the user and then update the table of the usr by IOM API method - usrMap.put ("USR_END_DATE", updatedEndDate);

    I wrote a small program, but it has erros. Please help me in this situation.
    ' public boolean updateEnddate (String usrKey, String managerKey, String NombreJours) {}
    Boolean result = false;
    String NombreJours;
    int totalNumUsers = 0;
    HashMap usrMap = new HashMap();
    usrMap.put ("Users.Key", usrKey);
    usrMap.put ("USR_MANAGER_KEY", managerKey);
    try {}
    DateFormat sdfSource = new SimpleDateFormat("yyyy-MM-dd");
    Date date = sdfSource.parse("USR_END_DATE");
    SimpleDateFormat sdfDestination = new SimpleDateFormat("dd-MMM-yyyy");
    String userEndDate = sdfDestination.format (date);
    tcResultSet = this.usrIntf.findUsers (usrMap) users;
    totalNumUsers = usersList.getRowCount ();
    If (totalNumUsers > 0)
    for (int i = 0; i < totalNumUsers; i ++) {}
    usersList.goToRow (i);
    updatedEndDate = userEndDate + NombreJours;
    usrMap.put ("USR_END_DATE", updatedEndDate);
    this.usrIntf.updateUser (users, usrMap);
    result = true;
    }
    on the other
    result = true;
    }




    Thank you
    Kalpana.

    Calculate the new date

    /**
    * This method is used to obtain the new date after adding x-days
    @param strDate - date today
    @param daysToAdd - x-days
    * @return Nouvelle_date - date after the addition of x days
    */
    private String incrementDate (Date strDate, int daysToAdd) {}
    Start date
    Logger.info("NotifyLastDayOfService::incrementDate(): entrez»);
    SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-DD 00:00:00");
    Dim str As String = sdf.format (strDate);
    Calendar c = Calendar.GetInstance ();
    try {}
    c.setTime (sdf.parse (str));
    } catch (ParseException exception) e {}
    e.printStackTrace ();
    }
    c.Add (Calendar.DATE, daysToAdd); number of days to add
    String PROMOTIONDate = sdf.format (c.getTime ());
    System.out.println ("calculated End Date:" + PROMOTIONDate);
    Logger.info("NotifyLastDayOfService::incrementDate(): sortie»);
    return Nouvelle_date;
    }

    This should solve your problem :)

  • Invites you in a view to filter the data of the other view

    All,

    I have 2 displays (bar and pie chart) in the same report. I put a prompt on the report where the user can select a date.

    Now, I want to display this quick only once on report and use this prompt to update the data in the two views. Where will I put this prompt and how to use it to filter the data in the two views?
    Must be the guest on the report so that the user can select date and time while displaying the report.

    Thanks for your help.

    Concerning

    I don't think so.
    Perhaps you want to reduce the dialog box, which will force the vertical alignment. No doubt put a logo in the Virgin region or something.

    Concerning
    Poyard

  • SQL queries for reports help: need to reverse the data in the column in columns [O

    Hi all

    I'm looking for help in writing SQL, where I need to reverse the data in the columns column.

    My data in DB is as below.

    VALUE OF NAME OF MONTH
    Jan-10 M1 5
    Jan-10 M2 8
    Jan-10 M3 9
    Feb-10 M1 4
    Feb-10 M2 6
    Feb-10 M3 2
    M4 10 Feb 10
    M1 10 Mar 21
    Mar-10 M2 6

    Power required for the declaration will be like:


    MONTHS M1 M2 M3 M4
    Jan-10 5 8 9
    Feb-10 4 6 2 10
    21 Mar-10 6

    How can I do this using SQL. [ORACLE 10g]?

    I can make use of server Oracle BI also.

    Please help me on this...

    I think this is wrong forum to ask this question. You want to do it in OBIEE or at the DB level. In oBIEE you can do in a table privot view.

    Thnaks,
    Knani

  • Need to reset the Data Warehouse

    Hello

    I need to reset the data warehouse so that I can start my first ETL process. However, I am not able to do DAC customer worm 7.9.5. When I click on 'Tools'-> 'management of ETL"->"Reset Data Warehouse"nothing pop up to do not know why, all other links and windows opens, with the exception of this. How can I solve this problem?

    Is it possible for me to do the reset manually?

    I checked on the internet and found AS below: -.

    D4 how do you run a full load (incremental)
    A: reset DataWarehouse. Just truncate the table S_ETL_REFRESH_DT in the repository of the dac

    So in our case, to truncate table will then be W_ETL_REFRESH_DT rite? Please confirm. We have planned to operate the ETL at 18:00 today.
    Y at - it all the other tables I need to truncate this way?

    Thank you
    Saran.

    Hello

    I worry if this window does not work correctly, you should probably work out why, I use 1.5.0_17 jdk in our environments (with apps 7.9.5) and that works fine, I suggest to try another version of the JDK and see if that fixes the problem.

    Kind regards

    Matt

  • Touch iPhone 5s does not not needing help for the data on it.

    iPhone 5 s (iOS 9) I have blue and red lines on the screen and the touch does not work at all, but the phone still works as usual outside the lines and contactless (voice on don't work/Siri as other items said worked, I do not have wifi for Siri). What I want is the data on the phone, I have a macbook pro (OS X 10.11) a fix would be better, but all I need is the data. I have icloud activated, but it was defective on my phone so don't know if I had a full backup and would like to know how to check. I have a form of computer backup about 2 months ago, but wanted all the pictures and data since then.

    At the back for up to my pc, I need is to unlock my phone, so any help will be appreciated.

    Thank you

    If connect to iTunes and perform a full backup

    And also connect on iCloud & see you backup recently

  • Need information about the data included in the example for the inner race with flaws

    Hello

    There are several examples for fault detection in bearing (Vibration tool sets). I need more information about these data include:

    -Bringing its specifications

    -How to perform data acquisition

    -a link to the tutorial

    I came across this manual that shows how to use OATS envelope detection VI to perform detection of failures of bearings.

    http://zone.NI.com/reference/en-XX/help/372416A-01/svtconcepts/cst_speed_brg/

    It lists the specifications of turnover:

    • Inch diameter 0,2813

    • Primitive diameter: 1,1228 inch

    • Speed: 1 234 RPM

    It also goes to the list of characteristic frequencies determined by these attributes.

    The data acquisition is carried out by the use of an accelerometer and a tachometer. These devices measure the vibration and the rotation speed of the bearing data. Failure detection uses a method called detection of the envelope to look at the signals of the bearing and compared to signals of standard bearings to the discovery of flaws. You can learn more about the method of acquisition of data here:

    http://zone.NI.com/reference/en-XX/help/372416A-01/svtconcepts/fault_detection/#Envelope_Detection

    The first link is a tutorial on the detection of failures in the bearings. The end of the link provides the location of an example VI that may also be useful.

  • need to record the data every second

    Hello

    So far so good with writing this simple .vi. I just have a problem. I need to record data every second. I use FieldPoint for thermocouple output signals. MAX is reading everything very well (I'm ambient recording, it is fondant between 80-83, so I put my stop for 83) and I can usually run the program for 5-10 seconds before my structure case is set to false and stops the .vi. When I open the file, I get data decimated. I tried a delay time and always the same. Not only she is decimated, but it does not record every second but between 5 to 10 seconds.

    How can I fix?

    .VI attached as well as the data element

    Thank you very much


  • Need to analyze the data $LogFile folder in NTFS fs

    Hello
    I need to know how to keep track of a deleted file data (more than 4 GB in size) in an NTFS partition.
    In NTFS file system a file attributes and its chain of clusters of data found in the MFT. If this file is greater than 4 GB in size, and I'm deleting it, the chain of groups of data in this file is also deleted in the MFT also. So I'm not able to follow this deleted file data.
    Another way to find his chain of clusters of data is going through $LogFile because the log file contains all the details of a file if the file is updated or deleted. Suppose that this deleted file data is not overwritten.
    Someone help me please how can I track the data from this file using $LogFile?
    How can we read reviews written in a log file?
    How can we jump on a string of cluster of data from a file deleted in $LogFile?

    Concerning
    Madan

    Hello

    The question you asked is beyond the scope of this forum.

    It would be best to ask your question at TechNet at the following link:

    http://social.technet.Microsoft.com/forums/en-us/category/windowsxpitpro

    Let us know if you have any questions.

    Best regards

    Matthew_Ha

  • Need to change the date of

    Oracle Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production version

    Hi gurus

    Need your help again and grateful if someone help out me. I have the following data:

    staging as

    (

    Select 100 grp, to_date('01032008','dd-mm-yyyy') bt_eff_dt, to_date('31034444','dd-mm-yyyy') bt_ter_dt double

    Union of all the

    Select 200 BRM, to_date('01052008','dd-mm-yyyy') bt_eff_dt, to_date('31034444','dd-mm-yyyy') bt_ter_dt double

    Union of all the

    Select 300 grp, to_date('01062008','dd-mm-yyyy') bt_eff_dt, to_date('31034444','dd-mm-yyyy') bt_ter_dt double

    ),

    Rondy as

    (

    Select 100 grp, to_date('01062006','dd-mm-yyyy') r_eff_dt, to_date('31034444','dd-mm-yyyy') r_ter_dt double

    Union of all the

    Select grp, to_date('01032008','dd-mm-yyyy') 100, to_date('28032015','dd-mm-yyyy') of the double

    Union of all the

    Select 200 BRM, to_date('01032008','dd-mm-yyyy'), to_date('28032015','dd-mm-yyyy') of the double

    Union of all the

    Select grp, to_date('01032010','dd-mm-yyyy') 300, the double to_date('28032015','dd-mm-yyyy')

    )

    Select s.grp, min (r_eff_dt), max (r_ter_dt)

    Since the staging of s, r rondy

    where s.grp = r.grp

    S.grp group

    ;

    The query result

    GRP, MIN (R_EFF_DT), MAX (R_TER_DT)

    10006/06/0144 03-31
    30003/10/0115/03/28
    20003/08/0115/03/28

    If you see the result of the query, and then there min and max date based on fiberglass but I need min and max date based on staging.bt_eff_dt.

    for example:

    -If rondy.r_eff_dt < staging.bt_eff_dt and other record exist in the table rondy for same grp who have same rondy.r_eff_dt as staging.bt_eff_dt can get to the records.

    -If rondy.r_eff_dt < staging.bt_eff_dt and any other file not exist in the table for same grp rondy then get the staging.bt_eff_dt.

    -If rondy.r_eff_dt > staging.bt_eff_dt then no change.

    On the basis of the above rule, my output should be:

    GRP, MIN (R_EFF_DT), MAX (R_TER_DT)

    1000103200828032015
    3000103201028032015
    20001052008' 28032015

    Please let me know if you have any questions and sorry for my bad English.

    Hello

    979596 wrote:

    Oracle Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production version

    ...

    staging as

    (

    Select 100 grp, to_date('01032008','dd-mm-yyyy') bt_eff_dt, to_date('31034444','dd-mm-yyyy') bt_ter_dt double

    Union of all the

    Select 200 BRM, to_date('01052008','dd-mm-yyyy') bt_eff_dt, to_date('31034444','dd-mm-yyyy') bt_ter_dt double

    Union of all the

    Select 300 grp, to_date('01062008','dd-mm-yyyy') bt_eff_dt, to_date('31034444','dd-mm-yyyy') bt_ter_dt double

    ),

    Rondy as

    (

    Select 100 grp, to_date('01062006','dd-mm-yyyy') r_eff_dt, to_date('31034444','dd-mm-yyyy') r_ter_dt double

    Union of all the

    Select grp, to_date('01032008','dd-mm-yyyy') 100, to_date('28032015','dd-mm-yyyy') of the double

    Union of all the

    Select 200 BRM, to_date('01032008','dd-mm-yyyy'), to_date('28032015','dd-mm-yyyy') of the double

    Union of all the

    Select grp, to_date('01032010','dd-mm-yyyy') 300, the double to_date('28032015','dd-mm-yyyy')

    )

    ...

    If you see the result of the query, and then there min and max date based on fiberglass but I need min and max date based on staging.bt_eff_dt.

    for example:

    -If rondy.r_eff_dt< staging.bt_eff_dt="" and="" other="" record="" exist="" in="" rondy="" table="" for="" same="" grp ="" that="" have="" same="" rondy.r_eff_dt="" like="" staging.bt_eff_dt ="" then="" get="" that="">

    -If rondy.r_eff_dt< staging.bt_eff_dt ="" and="" other="" record="" not="" exist="" in="" rondy="" table="" for="" same="" grp="" then="" get="" the="" staging.bt_eff_dt="">

    -If rondy.r_eff_dt > staging.bt_eff_dt then no change.

    On the basis of the above rule, my output should be:

    GRP, MIN (R_EFF_DT), MAX (R_TER_DT)

    100 01032008 28032015
    300 01032010 28032015
    200 01052008 ' 28032015

    Please let me know if you have any questions and sorry for my bad English.

    Are you sure that these are the results that you want from the given sample data?  Did you mean 01062008 for grp = 200, instead of 01052008?

    Here's one way:

    WITH got_r_num AS

    (

    SELECT r.grp, s.bt_eff_dt, r.r_ter_dt

    DENSE_RANK () OVER (PARTITION BY r.grp

    ORDER OF CASES

    WHEN r.r_eff_dt = s.bt_eff_dt

    THEN "A".

    OF ANOTHER 'B '.

    END

    ) AS r_num

    From rondy r

    S staging of JOIN ON s.grp = r.grp

    )

    SELECT the grp, bt_eff_dt, r_ter_dt

    OF got_r_num

    WHERE r_num = 1

    ;

  • Need to retrieve the data for the current date.

    Hello

    I have a table which then retrieves information when using this command.

    Select ta_acct, shift, created_on track_alerts;

    Technicolor A 24 March 14

    Technicolor A 24 March 14

    Technicolor A 24 March 14

    Technicolor A 24 March 14

    Manitoba telecom a 24 March 14 system

    Technicolor A 24 March 14

    I used this statement to retrieve the data for the given date.

    Select ta_acct, shift, created_on track_alerts where created_on = 24 March 14 ';

    Its not data recovery.

    Need help.

    Kind regards

    Prasad K T,.

    984002170

    Prasad K T wrote:

    Yes the created data type is date.

    CREATED_ON DATE

    Partha thanks it works now.

    Select ta_acct, shift, created_on in track_alerts where to move is: Shift and TRUNC (created_on) = TO_DATE('24-MAR-2014','DD-MON-YYYY');

    Still, I made a small change to my querry.

    Select ta_acct, shift, created_on track_alerts where to move is: shft and TRUNC (created_on) = TO_DATE (select double sysdate,'MON-DD-YYYY "");

    For this statement, it does not work.

    of course not...

    first: sysdate returns a date so no need of conversion here

    and

    second SYSDATE includes time, so your application should look like this:

    Select ta_acct, shift, created_on in track_alerts where to move is: Shift and TRUNC (created_on) = trunc (sysdate)

    or

    Select ta_acct, shift, created_on in track_alerts where to move is: shft and created_on > = trunc (sysdate) and created_on<>

    HTH

  • How can I filter the data and display it in the html table?

    Hello

    How do I filter data that contains the database table and already displayed in html table, then when the user write a data to filter or search, it will automatically display the data in html table. ?

    can someone help me to do this? Here is my php code for the table that will display the data:

    <?php
      $servername = "localhost";
      $username = "root";
      $password = "pass";
      $dbname = "ses";
       
       
      // Create connection
      $conn = new mysqli($servername, $username, $password, $dbname);
      // Check connection
      if ($conn->connect_error) {
      die("Connection failed: " . $conn->connect_error);
      }
       
      $sql = "SELECT No, Calon, ID, Jurusan FROM candidates";
    
      $result = $conn->query($sql);
      ?>
    
    <?php
      if ($result->num_rows > 0) {
      echo "<table >
    
      <tr>
      <th>NO</th>
      <th>Candidate</th>
      <th>ID Number</th>
      <th>Programme</th>
      <th>Edit</th>
      <th>Delete</th>
      </tr>";
      // output data of each row
      while($row = $result->fetch_assoc()) {
      echo "<tr>
      <td align='center'>" . $row["No"]. "</td>
      <td>" . $row["Calon"]. "</td>
      <td>" . $row["ID"]. " </td>
      <td>" . $row["Jurusan"]. "</td>
      <td align='center'><a href='main2.php?edit=".$row["No"]."'>Edit</a></td>
      <td align='center'><a href='delete.php?del=".$row["No"]."'>Delete</a></td>
      </tr>";
      }
    
      echo "</table>";
      } else {
      echo "0 results";
      }
      $conn->close();
      ?>
    

    hope someone can help me with this.

    Thank you.

    You must first create a search form for the user to enter a search word:

    Then create a page named search_page.php and insert the following code into it and save it. The code in red below Gets information from the search form field name = "Calon" and the SQL query finds in the "Calon" database field for a game.

    <>

    $servername = "localhost";

    $username = 'root ';

    $password = "pass";

    $dbname = 'his ';

    Create the connection

    $conn = new mysqli ($dbname, $servername, $username, $password);

    Check the connection

    If {($conn-> connect_error)

    Die ("connection failed:".) $conn-> connect_error);

    }

    $Calon = trim($_POST['Calon']);

    $sql = (' SELECT no, Calon, ID, Jurusan candidates WHERE Calon = "'.") $Calon.' » ") ;

    $result = $conn-> Query;

    ?>

    <>

    If ($result-> num_rows > 0) {}

    ECHO '.

    ";

    each line output

    While ($row = {$result-> fetch_assoc())}

    ECHO '.

    ";

    }

    ECHO '.

    NO. Candidate Identification number Program Edit Delete
    " . $row ["no"]. " " . $row ["Calon"]. " " . $row ['ID']. " " . $row ["Jurusan"]. " Edit Delete
    ";

    } else {}

    echo "0 results."

    }

    $conn-> close();

    ?>

Maybe you are looking for