SQL Language (MOSC)

MOSC Banner

SQL Query duplicate value

edited Sep 25, 2013 3:13AM in SQL Language (MOSC) 2 commentsAnswered
 SQL query
---------------------
 select * from (
    SELECT
     OPTION_ID,
     INSTALLATION_DATE,
     row_number() over (order by option_type ASC ) rownumber
    FROM
     v_device_options_details vdod
    WHERE vdod.EQUIPMENT_ID = 1604 AND vdod.EQUIPMENT_TYPE='module' AND vdod.TYPE = 'Static'
   ) where rownumber between 0 AND 24;


Result:
-----------------------
 OPTION_ID INSTALLATION_DATE  ROWNUMBER
---------- ----------------- ----------
      1009           1.4E+18                         1 
      1009                                                   2 
      1015           1.4E+18                         3 
      1015                                                   4 
      3921           1.4E+18                         5 


The above SQL giving me result for both row either installation_date is null or not null. I am looking if installation date has return two rows and one row is null  and another is not null then it should display one row only which is not null installation date. but if there is only one row whatever it is null or not null then it should return that row only 

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center