Sort order, that I need the analytical functions?

Hello

The table structure is

create the table test_order as
(
Ename varchar2 (100),
Qno number,
date of QDate
);

Data in it looks like

ENAME QNO QDATE
Laura 123 1/8/2009 10:00
Alfred 234 1/8/2009 11:00
Charles 435 1/8/2009 11:01
Alfred 456 1/8/2009 11:03
Laura 354 1/8/2009 14:00
Charles 565 1/8/2009 15:00


And the output should be the slot order

ENAME QNO QDATE
Laura 123 1/8/2009 10:00
Laura 354 1/8/2009 14:00
Alfred 234 1/8/2009 11:00
Alfred 456 1/8/2009 11:03
Charles 435 1/8/2009 11:01
Charles 565 1/8/2009 15:00

It should be sorted by qdate, but names should meet.
in the opposite case
grouped by ename, but sorted by time qdate - the oldest use this ename.

All solutions?

Thanks in advance.
SQL> create table test_order
  2  (
  3  ename varchar2(100),
  4  qno number,
  5  qdate date
  6  );

Table created.

SQL> insert into test_order values ('Laura', 123, to_date('1/8/2009 10:00:00 AM','dd/mm/yyyy hh:mi:ss am'));

1 row created.

SQL> insert into test_order values ('Alfred', 234, to_date('1/8/2009 11:00:00 AM','dd/mm/yyyy hh:mi:ss am'));

1 row created.

SQL> insert into test_order values ('Charles', 435, to_date('1/8/2009 11:01:00 AM','dd/mm/yyyy hh:mi:ss am'));

1 row created.

SQL> insert into test_order values ('Alfred', 456, to_date('1/8/2009 11:03:00 AM','dd/mm/yyyy hh:mi:ss am'));

1 row created.

SQL> insert into test_order values ('Laura', 354, to_date('1/8/2009 2:00:00 PM','dd/mm/yyyy hh:mi:ss am'));

1 row created.

SQL> insert into test_order values ('Charles', 565, to_date('1/8/2009 3:00:00 PM','dd/mm/yyyy hh:mi:ss am'));

1 row created.

SQL> select ename
  2       , qno
  3       , qdate
  4    from test_order
  5   order by min(qdate) over (partition by ename)
  6       , qdate
  7  /

ENAME             QNO QDATE
---------- ---------- -------------------
Laura             123 01-08-2009 10:00:00
Laura             354 01-08-2009 14:00:00
Alfred            234 01-08-2009 11:00:00
Alfred            456 01-08-2009 11:03:00
Charles           435 01-08-2009 11:01:00
Charles           565 01-08-2009 15:00:00

6 rows selected.

Kind regards
Rob.

Tags: Database

Similar Questions

  • Purpose of the ORDER BY clause in the analytic function Min Max

    I was always using analytical functions like Min Max without ORDER BY clause. But today I used with the ORDER BY clause. The results are very different. I would like to know the purpose of the ORDER BY clause in Min, Max and analogues of analytical functions.

    user10566312 wrote:
    I was always using analytical functions like Min Max without ORDER BY clause. But today I used with the ORDER BY clause. The results are very different. I would like to know the purpose of the ORDER BY clause in Min, Max and analogues of analytical functions.

    It is a good point that many developers are not so aware. As far as I understand it the way it works.

    Some analytical functions do not need an order by or windowing clause (SUM, COUNT, MIN, etc.). If there is no specified window, then the full score is the window.
    As soon as you add a command also add you a windowing clause. This window has the default value of 'rank ofrows between unbounded preceding and current_row. So as soon as you add an order by clause, you get a sliding window.

    Documentation: http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions001.htm

    windowing_clause
    ...
    You cannot specify this clause unless you specified the order_by_clause. Window limits defined by the clause RANGE you can not specify only a single expression to the > order_by_clause. Please refer to 'Restrictions on the ORDER BY Clause'.

    example of

    with testdata as (select 10 numval, level lv from dual connect by level < 10)
    select lv, numval, sum(numval) over () sum1, sum(numval) over (order by lv) sum2
    from testdata;
    
    LV NUMVAL SUM1 SUM2
    -- ------ ---- ----
     1     10   90   10
     2     10   90   20
     3     10   90   30
     4     10   90   40
     5     10   90   50
     6     10   90   60
     7     10   90   70
     8     10   90   80
     9     10   90   90 
    

    Published by: Sven w. on 25 Sep 2012 16:57 - default behavior has been corrected. Thanks to Chris

  • A question about the analytical function used with the GROUP BY clause in SHORT

    Hi all

    I created the following table named myenterprise
    CITY       STOREID    MONTH_NAME TOTAL_SALES            
    ---------- ---------- ---------- ---------------------- 
    paris      id1        January    1000                   
    paris      id1        March      7000                   
    paris      id1        April      2000                   
    paris      id2        November   2000                   
    paris      id3        January    5000                   
    london     id4        Janaury    3000                   
    london     id4        August     6000                   
    london     id5        September  500                    
    london     id5        November   1000
    If I want to find which is the total sales by city? I'll run the following query
    SELECT city, SUM(total_sales) AS TOTAL_SALES_PER_CITY
    FROM myenterprise
    GROUP BY city
    ORDER BY city, TOTAL_SALES_PER_CITY;
    that works very well and produces the expected result, i.e.
    CITY       TOTAL_SALES_PER_CITY   
    ---------- ---------------------- 
    london     10500                  
    paris      17000            
    Now in one of my books SQL (Mastering Oracle SQL) I found another method by using the SUM, but this time as an analytic function. Here's what the method of the book suggests as an alternative to the problem:
    SELECT city, 
           SUM(SUM(total_sales)) OVER (PARTITION BY city) AS TOTAL_SALES_PER_CITY
    FROM myenterprise
    GROUP BY city
    ORDER BY city, TOTAL_SALES_PER_CITY;
    I know that the analytic functions are executed after the GROUP BY clause has been transformed completely and Unlike regular aggregate functions, they return their result for each line belonging to the partitions specified in the partition clause (if there is a defined partition clause).

    Now my problem is that I do not understand what we have to use two functions SUM? If we only use one only, i.e.
    SELECT city, 
           SUM(total_sales) OVER (PARTITION BY city) AS TOTAL_SALES_PER_CITY
    FROM myenterprise
    GROUP BY city
    ORDER BY city, TOTAL_SALES_PER_CITY;
    This generates the following error:
    Error starting at line 2 in command:
    SELECT city, 
           SUM(total_sales) OVER (PARTITION BY city) AS TOTAL_SALES_PER_CITY
    FROM myenterprise
    GROUP BY city
    ORDER BY city, TOTAL_SALES_PER_CITY
    Error at Command Line:2 Column:11
    Error report:
    SQL Error: ORA-00979: not a GROUP BY expression
    00979. 00000 -  "not a GROUP BY expression"
    *Cause:    
    *Action:
    The error is generated for the line 2 column 11 which is, for the expression SUM (total_sales), well it's true that total_sales does not appear in the GROUP BY clause, but this should not be a problem, it has been used in an analytical function, so it is evaluated after the GROUP BY clause.

    So here's my question:

    Why use SUM (SUM (total_sales)) instead of SUM (total_sales)?


    Thanks in advance!
    :)





    In case you are interested, that's my definition of the table:
    DROP TABLE myenterprise;
    CREATE TABLE myenterprise(
    city VARCHAR2(10), 
    storeid VARCHAR2(10),
    month_name VARCHAR2(10),
    total_sales NUMBER);
    
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('paris', 'id1', 'January', 1000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('paris', 'id1', 'March', 7000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('paris', 'id1', 'April', 2000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('paris', 'id2', 'November', 2000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('paris', 'id3', 'January', 5000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('london', 'id4', 'Janaury', 3000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('london', 'id4', 'August', 6000);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('london', 'id5', 'September', 500);
    INSERT INTO myenterprise(city, storeid, month_name, total_sales)
      VALUES ('london', 'id5', 'November', 1000);
    Edited by: dariyoosh on April 9, 2009 04:51

    It is clear that thet Analytics is reduntant here...
    You can even use AVG or any analytic function...

    SQL> SELECT city,
      2         avg(SUM(total_sales)) OVER (PARTITION BY city) AS TOTAL_SALES_PER_CITY
      3  FROM myenterprise
      4  GROUP BY city
      5  ORDER BY city, TOTAL_SALES_PER_CITY;
    
    CITY       TOTAL_SALES_PER_CITY
    ---------- --------------------
    london                    10500
    paris                     17000
    
  • SQL using the analytic function


    Hi all

    I want a help in the creation of my SQL query to retrieve the data described below:

    I have a test of sample table containing data as below:

    State ID Desc

    MICHAEL 1 T1

    ACTIVE 2 T2

    T3 3 SUCCESS

    DISABLE THE T4 4

    The thing I want to do is to select all the lines with an ACTIVE status in the table but is there is no ACTIVE status, my request will give me the last line with MICHAEL status.

    I can do this in a single request by using the analytical function for example, if yes can yiu help me on the request of unpacking.

    Kind regards

    Raluce

    Something like that?

    I had to fix it.

    with testdata until)
    Select 1 id, "T1" dsc "DISABLED" status of Union double all the
    Select 2 id, 'T2' dsc, the status "ACTIVE" of all the double union
    Select id 3, "T3" dsc, the status of 'SUCCESS' of all the double union
    Select 4 id, "T4" dsc "DISABLED" status of double
    )

    Select
    ID
    dsc
    status
    of testdata
    where
    status =
    -case when (select count (*) in testdata where status = 'ACTIVE') > 0
    then 'ACTIVE '.
    Another 'DISABLED '.
    end
    and)
    ID in (select id from testdata where status = ' ACTIVE')
    or
    ID = (select max (id) in testdata when status = 'DISABLED')
    )

    STATE ID DSC

    '2' 'T2' 'ACTIVE '.

    Maybe it's more efficient

    Select
    ID
    dsc
    status
    of testdata
    where
    status =
    -case when (select count (*) in testdata where status = 'ACTIVE') > 0
    then 'ACTIVE '.
    Another 'DISABLED '.
    end
    and
    ID =)
    -case when (select count (*) in testdata where status = 'ACTIVE') > 0
    then id
    on the other
    (select max (id) in testdata when status = 'DISABLED')
    end
    )

    Post edited by: correction of chris227

    Post edited by: chris227
    extended

  • Are aware that even if the rotation function is no longer available on the new trackpad, it is always presented on their Apple tutorial. Please discuss!

    Are aware that even if the rotation function is no longer available on the new trackpad, it is always presented on their Apple tutorial. Please discuss!

    Hello

    Read this article to support > gestures multitouch for use on your Mac - Apple supported

  • I tried to play some movies that I downloaded, but it says that I need the right codec to play.

    Original title: watch videos on media player

    I have an old computer for my son with XP on it. I tried to play some movies that I downloaded, but it says that I need the right codec to play. How can I fix that I can watch these videos?

    Hello

    1. what version of windows media player do you use?
    2. what type of media files are they?

    Check the following article to see if these files are supported by the Windows media player installed on the computer. If these files are not supported, then you will need to download the third-party codec to play.

    Information on the types of media files that supports Windows Media Player
    http://support.Microsoft.com/kb/316992

    THIRD WARNING:

    Using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.

    For more information:
    How to Download Codecs automatically in Windows Media for Windows XP player
    http://support.Microsoft.com/kb/291818

  • I am trying to install Windows 7 on my hard drive, but the installer tells me that I need the driver "Promise Technology Inc. Ultra IDE Controller".

    I'm trying to install Windows 7 on a (40.1 GB) partition on my hard drive, but the installer tells me that I need the driver (Promise Technology Inc. Ultra IDE Controller.  I searched the Internet and tried several, but no results.  Can someone point me in the right direction.  I have a box to open with Technical Support, but not a lot of help out there.

    Thanks in advance

    Joe Franklin

    original title: installation of Windows 7

    Hey Joe,

    I suggest that you visit the gigabyte website for your region (and/or the site global http://www.gigabyte.com/?f=g ) and check your motherboard for compatibility with Windows 7.

    The problem you are experiencing would imply that Windows 7 has no native driver support for your disk controller, so if Gigabyte don't have drivers that you are locked unless you buy a discreet disk controller that is compatible Windows 7.

    Please mark this as useful or response if applicable.

    On the other hand, you have this posted in a forum of Windows XP when it is really a problem of Windows 7.

    Tricky

  • I said that I need the permission of the administrator (I am the administrator) to copy a file to one external hard drive to another.

    I said that I need the permission of the administrator (I am the administrator) to copy a file to one external hard drive to another. I used the same computer and peripheral for the past two years with no problems until today when I opened upward after being away on vacation. I use Windows 7. I'd appreciate any help out there.

    BHA

    Original title: the administrator permission

    How to open a file if I get an access denied message?

    http://Windows.Microsoft.com/en-us/Windows7/how-do-i-open-a-file-if-i-get-an-access-denied-message

    Troubleshoot "access denied" when opening files or folders [good for Win7, too]

    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-access-denied-when-opening-files-or-folders

    Windows 7: access denied - WHY?

    http://www.SevenForums.com/general-discussion/19745-access-denied-why.html

  • Try installing Adobe Acrobat 8 on Windows 8. It says that I need the file AdobePDF.dll on Windows Vista CD-ROM. Where can I find this file?

    Try installing Adobe Acrobat 8 on Windows 8.  It says that I need the file AdobePDF.dll on Windows Vista CD-ROM. Where can I find this file?

    Acrobat 8 is compatible with Vista, Windows 7 or 8. She asked the AdobePDF.dll and if you can get it, the installer asks for another, then another, the... and it would not work properly. If you want a compatible version, go here...

    http://www.Adobe.com/CA/products/Acrobat.html

  • Adobe first Elements 13 is listed as $79.99 (alone) or WITH Adobe Photoshop elements 13 for $119.99 (for both). I bought 13 items first by itself for $79.99.   Now, I realize that I need the 13 elements of Photoshop also.     My question I

    This is my first attempt in the Adobe community. I hope I'm doing this correctly.

    Please send me an email to [email protected] If you can answer my question.

    I'll paste it again here. Thank you! John

    QUESTION:

    Adobe first Elements 13 is listed as $79.99 (alone) or WITH Adobe Photoshop elements 13 for $119.99 (for both). I bought 13 items first by itself for $79.99.   Now, I realize that I need the 13 elements of Photoshop also.My question is: can I put the $40 more (purchase price of $119.99 in combination) to buy the 13 elements of Photoshop? Or do I have to pay the price of $79.99 (yet) to buy the 13 elements of Photoshop?There is no option to upgrade on the website of the $40 more purchase price (which would be equivalent to the original price of combination $119.99) after I bought the first 13 items only ($79.99).

    gt40john

    This isn't Adobe. Instead essentially a user to user forum.

    Suppose you bought the items 13 as a download from Adobe first.

    Adobe sells more than 13 Photoshop or Premiere elements 13 elements. He sells only the latest version now (v14).

    If you bought the first 13 elements download Adobe over the last 30 days, you should be able to request a return/refund from Adobe. I do not know how he would deal with an Exchange because it sells more than 13 - May 14 deal might be involved? Just in case you are eligible, Contact Customer Care

    And, if you bought elsewhere (from an authorized dealer), you are governed by the policy of return/refund/exchange of the authorized dealer, not Adobe direct.

    But if you are not within 30 days of the purchase, you'll probably eventually find a dealer authorized to buy Photoshop elements 13, although it is still available.

    Many scenarios here, but you should have business with Adobe on this if it goes back to the purchase of Adobe. If this isn't a direct purchase from Adobe, your fate is up to the dealer.

    RTA

    Add on... Please don't include contact information in your messages to avoid unwanted nuisance to your contact information.

    A moderator may delete such information once it is noticed by a moderator.

  • Ive needs to open a document and it says that I need the most recent version. IM the 11.0.09 running on windows 7 help!

    Ive needs to open a document and it says that I need the most recent version. IM the 11.0.09 running on windows 7 help!mycic error adobe.png

    Ive followed the link several times and updated to the latest version, what I am doing wrong?

    Hi stuartosachuk,

    Type chrome://plugins in the address bar of Chrome. Then, disable "Chrome PDF Viewer" and select "Adobe Reader" plug-in as shown in the screenshot below:

    Now, close the Plug-ins tab and restart Chrome.

    Kind regards

    Ana Maria

  • Report Builder 6i do not recognize the analytical functions

    Hi all, in an attempt to speed up a slow query, I applied the analytical function to it. I can save the query in the generator without any problem, however, I can't create data between this request and other links. After I have comment on the analytical function, data bindings can be made. My colleague says Report Builder 6i is too old so he can recognize only the ANSI SQL syntax. Since our server DB uses Oracle 10 g 2, is there a way for the generator of reports to identify and compile syntax of Oracle 10 g?

    Thank you very much.

    Hello

    Your colleague is right. Even if the SQL query is executed by the DB server, reports must analyze the SQL query.

    The SQL parser included in reports 6i-based 8.0.6

    You can see this version using the report designer:

    Menu: Help-> on Report Builder...

    ORACLE Server Release 8.0.6.0.0

    Concerning

  • By using the analytical function to sort without showing this column in the result.

    Hello

    We use the Oracle 11.2

    How to use Oracle Analytics to sort the output of a query without showing this column in the result?

    Here's my query:

    Select distinct nvl(SRC_CHR_NM,'0') | » #'|| NVL(EXPL_SRC,'0') | » #'|| NVL(DIM_NM,'0') | » #'|| NVL(DIM_CHR_NM,'0') | » #'|| NVL(DIM_CHR_ABR,'0') | » #'||

    Decode (InStr (NVL(SRC_COL_NM,'0'), 'trim ('),'1 ', Replace (NVL(SRC_COL_NM,'0'),'trim (',' trim(PRM_DTL.'), '0',' PRM_DTL.)))) » || NVL(SRC_COL_NM,'0')) AS ALLOFIT,

    DIM_NM

    from EXPL_CONFIG where SBJ_AREA_CD = 'PRMDTL. '

    I want to use analytical to sort by DIM_NM but I do not want to show. I want to just just the ALLOFIT column to show in the output.

    Something like "row_number() over (order by DIM_NM desc).

    Thank you!

    Hello

    If you SELECT SEPARATE, then you can only ORDER OF things in the SELECT clause. (Do you really need to do SELECT DISTINCT?  Often, it's just an inefficient way to remove the lines that do not need to be there at all).

    Move making the SELECT DISTINCT in a subquery and make the ORDER BY (and nothing else) in the main query.

    I hope that answers your question.

    If this isn't the case, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) and also publish outcomes from these data.

    Explain, using specific examples, how you get these results from these data.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002#9362002

  • Need help with the analytic function

    I want to get the highest employee details and the 2nd highest employee for a particular service. But also the Department should have more than 1 employee.
    I tried the query and it gave me the correct results. But I wonder if there is another solution than to use the subquery.

    Here is the table and the query result:
    with t as
    (
    select 1 emp_id,3 mgr_id,'Rajesh' emp_name,3999 salary,677 bonus,'HR' dpt_nme from dual union
    select 2 ,3 ,'Gangz',4500,800,'Finance' from dual  union
    select 3 ,4 ,'Sid',8000,12000,'IT' from dual  union
    select 4 ,null,'Ram',5000,677,'HR' from dual  union
    select 5 ,4,'Shyam',6000,677,'IT' from dual union
    select 6 ,4 ,'Ravi',9000,12000,'IT' from dual   
    )
    select * from 
    (select emp_id, mgr_id, emp_name, dpt_nme, salary, row_number() over (partition by dpt_nme order by salary desc) rn from t where dpt_nme in 
    (select dpt_nme from t group by dpt_nme having count(*) > 1)) where rn < 3

    Hello

    You need a subquery, but you don't need more than that.
    Here's a way to eliminate the additional subquery:

    WITH     got_analytics     AS
    (
         SELECT  emp_id,     mgr_id,     emp_name, dpt_nme, salary
         ,     ROW_NUMBER () OVER ( PARTITION BY  dpt_nme
                                   ORDER BY          salary     DESC
                           )         AS rn
         ,     COUNT (*)     OVER ( PARTITION BY  dpt_nme
                                       )         AS dpt_cnt
         FROM     t
    )
    SELECT  emp_id,     mgr_id,     emp_name, dpt_nme, salary
    ,     rn
    FROM     got_analytics
    WHERE     rn     < 3
    AND     dpt_cnt     > 1
    ;
    

    Analytical functions are calculated after the clause WHERE is applied. Since we need to use the results of the analytical ROW_NUMBER function in a WHERE clause, which means that we have to calculate ROW_NUMBER in a subquery and use the results in the WHERE clause of the main query. We can call the COUNT function analytical in the same auxiliary request and use the results in the same WHERE clause of the main query.

    Would what results you if there is a link for the 2nd highest salary in some Department? For example, if you add this line to your sample data:

    select 7 ,3 ,'Sunil',8000,12000,'IT' from dual  union
    

    ? You can use RANK rather than ROW_NUMBER.

  • Understanding on the analytical function sum() (order of)

    Could you please explain Having_order_by of the calculation of values of below query column?
    I understand that No_Partition column was calculated on the full set of results
    select level
    ,sum(level) over(order by level) Having_order_by
    ,sum(level) over() No_Partition
    from dual 
    connect by level < 6

    Hello

    ActiveSomeTimes wrote:
    Could you please explain Having_order_by of the calculation of values of below query column?
    I understand that No_Partition column was calculated on the full set of results

    select level
    ,sum(level) over(order by level) Having_order_by
    ,sum(level) over() No_Partition
    from dual
    connect by level < 6
    

    When you have an ORDER BY clause, the function works only on a window, which is a subset of the result set, compared to the current line.
    When you say 'ORDER OF LEVEL', it only will work on levels less than or equal to its current LEVEL, etc.
    LEVEL = 1, the analytic fucntion will only look at the LEVEL<= 1,="" that="" is,="" just="" 1;="">
    LEVEL = 2, the analytic fucntion will only look at the LEVEL<= 2,="" that="" is,="" 1="" and="" 2;="">
    LEVEL = 3, the analytic fucntion will only look at the LEVEL<= 3,="" that="" is,="" 1,="" 2="" and="">
    ...
    LEVEL = 6, the analytic fucntion will only look at the LEVEL<= 6,="" that="" is,="" 1,="" 2,="" 3,="" 4,="" 5="" and="">

    In the call to function without the ORDER BY clause, the examines the entire results full regrdless of what value LEVEL has on the current line.

Maybe you are looking for

  • Re: DDR2dimm or DDR2sodimm - what we buy for Equium series

    Hello, I was looking at some sites and am confused on what I need to buy the memory, I discovered that I need DDR2 RAM, but there seems to be two types-dimm and sodimm - until those who must get advice? Thanks for any help

  • Black screen on Satellite M40-185

    After that a few months of problems with switch-offs sudden finally my Toshiba Satellite M40 - 185 is a black screen and it cannot do more. I have an external monitor, but it is also black.Should I try to get a new LCD inverter or leave the Toshiba s

  • Satellite C650D-112 - reinstall Win 7 after the failure of HARD drive

    The 320 HDD on my C650D-112 18 months, failed last week.I replaced it with a 128 GB SSD and it now boots into Windows 8 preview in about 10 seconds! I have a copy of the disk HARD original including the recovery of HARD drive Partition, but no recove

  • Pavilion dv2 laptop: how to drive to create an Image for Vista?

    Due to d/l & updated Vista installation problems, I decided to use my HP recovery disks to restore my laptop as long as you plant. It seemed like the most logical approach to carry out several tasks, such as deleting a 2nd user & general cleaning of

  • Reinstalling Windows XP: Boot from ATAPI CD-ROM: failure

    Hi all I'm trying to format my PC to reinstall Windows XP. I set the BIOS to select CD-Room as a first option, but when I restart the PC, instead of getting the message "Press any key to boot from CD", I get this "Boot from ATAPI CD-ROM: failure...»