Select max in a specific range only?

Hello experts and pros of sql!

I guess that I need your help on a problem I've been struggling with for hours now.

I have the following query, which, in the final version will be written in the pl/sql code:
SELECT
     CNT_GEBIET,
     CNT_GEBIET DISPLAY,
     CNT_GEBIET BUTTON,
     STR_NAME,
     decode(STR_ART_GEBIETE,'Vogelschutz','SPA','FFH','FFH','FFH und Vogelschutz','FFH & SPA') STR_ART_GEBIETE,
     STR_REG_KART_TEAMS,
     STR_BESCHREIBUNG,
     BOOL_ANZEIGEN,
     STR_FEDERFUEHRENDE,
     K.INT_VERFAHREN,
     STR_VERFAHREN,
     D.ST_BIOGEO,
     D.STR_GEBIET,
     E.STR_BIOGEO,
     E.INT_BIOGEO,
case when to_char(min(L.DATE_GP_RT_END), 'YYYY') < to_char(sysdate, 'YYYY')  then 'red'
else 'green' end as mxcolour,
case when to_char(min(L.DATE_R_AT_END), 'YYYY') <= to_char(sysdate, 'YYYY') then 'green'
when to_char(min(L.DATE_R_V_END), 'YYYY') > to_char(min(L.DATE_GP_V_END), 'YYYY') then 'red'
else 'black' end as mxcolour_r_date,
   to_char(min(L.DATE_GP_AT_START), 'YYYY')  DATE_GP_AT_START,
   to_char(min(L.DATE_R_AT_END), 'YYYY')  DATE_R_AT_END,
   to_char(min(L.DATE_GP_V_START), 'YYYY')  DATE_GP_V_START,
   to_char(min(L.DATE_R_V_END), 'YYYY')  DATE_R_V_END,
   to_char(min(L.DATE_GP_RT_START), 'YYYY')  DATE_GP_RT_START,
   to_char(min(L.DATE_R_RT_END), 'YYYY')  DATE_R_RT_END,
   I.GEB,
   I.STR_REGBEZE,
   H.ALF,
   I.LNG_REG_KART_TEAMS,

   MAX(NVL(M.LNG_ARBEITSSCHRITT,21)) LNG_ARBEITSSCHRITT

FROM VT_TBL_ARBEIT_ZU_GEBIET M
RIGHT OUTER JOIN (
  VT_TBL_GEBIET K
  INNER JOIN VT_TBL_ART_GEBIETE B ON B.CNT_ART_GEBIETE = K.INT_ART_GEBIET
  INNER JOIN VT_TBL_FEDERFUEHRENDE C ON C.CNT_FEDERFUEHRENDE = K.LNG_FEDER
  INNER JOIN VT_TBL_GEBIET_ZU_BIOGEO D ON D.STR_GEBIET = K.CNT_GEBIET
  INNER JOIN VT_TBL_BIOGEO E ON D.ST_BIOGEO = E.INT_BIOGEO
  INNER JOIN VT_TBL_VERFAHREN F ON F.CNT_VERFAHREN = K.INT_VERFAHREN
  INNER JOIN VT_TBL_REG_KART_TEAMS G ON G.CNT_REG_KART_TEAMS = K.INT_REG_KART_TEAMS
  INNER JOIN VT_TBL_GEBIET_ZU_ALF H ON H.GEBIET = K.CNT_GEBIET
  INNER JOIN TBL_REGBEZE I ON I.GEB = K.CNT_GEBIET
      AND I.LNG_REG_KART_TEAMS = G.CNT_REG_KART_TEAMS
) ON M.LNG_GEBIET = K.CNT_GEBIET
LEFT OUTER JOIN TBL_ARBEITSSCHRITTE_NEU A
  ON M.LNG_ARBEITSSCHRITT = A.CNT_ARBEITSSCHRITT
left outer join vt_tbl_arbeit_crit_date l on l.lng_gebiet = k.cnt_gebiet
   where k.cnt_gebiet not like '%Test%' and nvl(m.lng_arbeitsschritt,21) not in (1,4,13,23,28,31,45,54,60,66,73,78) and nvl(l.lng_arbeitsschritt,1) = 1
GROUP BY
    CNT_GEBIET,
    STR_NAME,
    STR_ART_GEBIETE,
    STR_REG_KART_TEAMS,
    LNG_REG_KART_TEAMS,
    H.ALF,
    STR_BESCHREIBUNG,
    BOOL_ANZEIGEN,
    STR_FEDERFUEHRENDE,
    D.ST_BIOGEO,
    D.STR_GEBIET,
    E.STR_BIOGEO,
    E.INT_BIOGEO,
    F.STR_VERFAHREN,
    K.INT_VERFAHREN,
    I.GEB,
    I.STR_REGBEZE,
    L.DATE_GP_AT_START,
    L.DATE_R_AT_END,
    L.DATE_GP_V_START,
    L.DATE_R_V_END,
    L.DATE_GP_RT_START,
    L.DATE_R_RT_END
My problem is that I want to select MAX (M.LNG_ARBEITSSCHRITT) while the max value is supposed to be limited to a specific range.

Indeed, the 1,4,13,23,28,31,45,46,54,60,66,73,78 values should not take into account.

Can you please show me how to specify a range of values that can be used for the calculation of the max (m.lng_arbeitsschritt)?

I appreciate your help and your entry!

Thank you to have a look at this post!

Kind regards

SEB

Try:

max(case when M.LNG_ARBEITSSCHRITT not in (1,4,13,23,28,31,45,46,54,60,66,73,78) then M.LNG_ARBEITSSCHRITT end)

Tags: Database

Similar Questions

  • With the help of SELECT MAX (Substr (in a subquery to return specific lines

    Oracle v10

    Here is an example of a query and the output
    SELECT ID, SAMPLEID, COMPOUNDNAME, REQUISITION, SUBSTR(REQUISITION,2,4) FROM SEARCH PL1 WHERE SAMPLEID = 'IA 0005 0166';
    
    86907     IA 0005 0166     IA 0005     R2004:001160     2004
    98158     IA 0005 0166     IA 0005     R2005:000956     2005
    I try to return only the last line of data, in this case the line 2005.

    I tried
    SELECT ID, SAMPLEID, COMPOUNDNAME, REQUISITION, SUBSTR(REQUISITION,2,4) FROM SEARCH PL1 
    WHERE SAMPLEID = 'IA 0005 0166' AND
    REQUISITION IN 
    (SELECT MAX(SUBSTR(REQUISITION,2,4)) FROM SEARCH PL2 
    WHERE SUBSTR(PL2.REQUISITION,2,4) = SUBSTR(PL1.REQUISITION,2,4));
    But it returns no results. According to me, only missing me something simple.

    TIA

    You probably meant it?

    SELECT ID, SAMPLEID, COMPOUNDNAME, REQUISITION, SUBSTR(REQUISITION,2,4)
    FROM SEARCH PL1
    WHERE SAMPLEID = 'IA 0005 0166'
    AND SUBSTR(REQUISITION,2,4) = (
      SELECT MAX(SUBSTR(PL2.REQUISITION,2,4))
      FROM SEARCH PL2
      WHERE PL2.SAMPLE_ID = PL1.SAMPLE_ID
    );
    

    that could also be achieved with a single table access:

    SELECT id, sampleid, compoundname, requisition, sub_req
    FROM (
      SELECT id, sampleid, compoundname, requisition, substr(requisition,2,4) sub_req,
             row_number() over(order by substr(requisition,2,4) desc) rn
      FROM search PL1
      WHERE sampleid = 'IA 0005 0166'
    )
    WHERE rn = 1
    ;
    
  • specific range

    Hello

    I have some data (depending on the frequency Magnitude), I want to simply select the points that lie within a specific range (frequency... Category axis), for example, I want to filter the signal only for points that are between 20 and 30 Hz. Someone know how I can do?

    I used "line and force", but it gives the 'threshold' for points that don't are not in it rang. I don't want to choose which points.

    I got appreaciate it.

    Thank you

    Petar

    Hello

    I think you can try to use a loop For instead of the function "in range and force." Simply enter your data in the loop, and using a tunnel conditional you can compare the data that you want. I have attached a picture of a small example, I created for you to see.

  • Select Max (date) multiple records

    I'm having a problem getting the last value for several gauges.  Here's my query:

    SELECT parameter_id,

    TS_ID,

    value,

    Location_id,

    Date_Time

    Of

    MyTable

    JOIN IN-HOUSE

    mytable2

    WE

    TS_ID = ts_id

    WHERE

    TS_ID LIKE '% - rev.

    unit_id = ("pi")

    the value IS NOT NULL

    Location_id as "xxxx".

    Date_Time =

    (SELECT Max (date_time)

    My TABLE

    GROUP BY parameter_id)

    ;

    Hello

    A scalar subquery, such as the expression to the right of the sign =

    Date_Time = (SELECT...)

    must produce (at most) only 1 row.  If the subquery produces 2 or more lines, it will trigger an error.

    Given that you are using "GROUP BY parameter_id" in the subquery, it will produce a separate line of output for each distinct value of parameter_id.  You can use a correlated subquery at that time, that only looks like a parameter_id, or you can use a subquery IN, like this:

    WHERE (parameter_id, Date_Time) IN

    (

    SELECT parameter_id

    MAX (date_time)

    FROM MyTable

    GROUP BY parameter_id

    )

    I hope that answers your question.
    If not, 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

  • Script to list the number of PO in a specific range of accounting code

    Helloo

    I need a script to list all PO numbers within a specific range of accounting code.  The script is used for the assessment of the stock.

    Grateful if someone can help.

    Hello

    Please, if this answer is late; just ignore it

    The following SQL select statement assumes that you know the costs/inv. natural accounts of valuation and natural account segment is 2:

    Select po_num, authorization_status, closed_code

    of PO_DISTRIBUTIONS_INQ_V one

    where destination_type_code = no ('STOCK', 'FEES')

    and a.code_combination_id in

    (select b.code_combination_id in the GL_CODE_COMBINATIONS_V b where segment2 = all ('170702110', '720201000'))

    "170702110", "720201000" are natural sample accounts

    Thank you

  • Update statement Select MAX

    Hello guys, small head scratcher here (probably just my mind head)

    Summary of the issue: Updated between two tables, try to use the rank, will not work.

    I took a few of the fields of interest here: -.
    CREATE TABLE spell_tags (
          Spell_ID             varchar2(50) ,
          service_line_spell     varchar2(25) );
    CREATE TABLE ranked_spells(
         spell_ID varchar2(10) ,
         dominant_SSNDS varchar2(25) ,
         service_line varchar2(25) ,
         Rank varchar2(3) NOT NULL ) ;
    Samples: -.
    INSERT INTO RANKED_SPELLS ("SPELL_ID" ,"DOMINANT_SSNDS" ,"SERVICE_LINE" ,"RANK" ) VALUES ('100002' ,'08' ,'SD08o' ,'213' );
    INSERT INTO RANKED_SPELLS ("SPELL_ID" ,"DOMINANT_SSNDS" ,"SERVICE_LINE" ,"RANK" ) VALUES ('100002' ,'08' ,'SD08s' ,'210' );
    INSERT INTO RANKED_SPELLS ("SPELL_ID" ,"DOMINANT_SSNDS" ,"SERVICE_LINE" ,"RANK" ) VALUES ('100003' ,'08' ,'SD22m' ,'416' );
    INSERT INTO RANKED_SPELLS ("SPELL_ID" ,"DOMINANT_SSNDS" ,"SERVICE_LINE" ,"RANK" ) VALUES ('100003' ,'08' ,'SD23x' ,'207' );
    INSERT INTO SPELL_TAGS ("SPELL_ID" , "SERVICE_LINE_SPELL"  ) VALUES ('100002' ,'' );
    INSERT INTO SPELL_TAGS ("SPELL_ID" , "SERVICE_LINE_SPELL"  ) VALUES ('100003' ,'' );
    Data looks like this: -.
     Select * from spell_tags;
    
    SPELL_ID                                           SERVICE_LINE_SPELL
    -------------------------------------------------- -------------------------
    100002
    100003
    
    2 rows selected.
    
    
     Select * from ranked_spells;
    
    
    SPELL_ID   DOMINANT_SSNDS            SERVICE_LINE              RANK
    ---------- ------------------------- ------------------------- ---
    100002     08                        SD08o                     213
    100002     08                        SD08s                     210
    100003     08                        SD22m                     416
    100003     08                        SD23x                     207
    
    4 rows selected.
    Basically, I need to run and update the declaration (not plsql) to update the Spell_tags table service_line_spell field with the service_line of the ranked_spells table (lowest rank)

    Here are a few failed attempts, do not laugh ;)
    update spell_tags
    set service_line_spell = (select max(service_line) from ranked_spells
    where spell_tags.spell_id = ranked_spells.spell_ID
    group by service_line, rank
    having rank = min(rank))
    where spell_ID in (select distinct spell_ID from ranked_spells);
    
    ERROR at line 2:
    ORA-01427: single-row subquery returns more than one row
    
    
    update speccom.spell_tags
    set service_line_spell = (select b.service_line from ranked_spell b
    where spell_tags.spell_id = ranked_spells.spell_ID
    and ranked_spells.rank = min(ranked_spells.rank) group by service_line, rank)
    where exists
    (select spell_ID from ranked_spells
    where spell_ID in (select distinct spell_ID from ranked_spells);
    
    ERROR at line 4:
    ORA-00934: group function is not allowed here
    This is the result, I need: -.
     Select * from spell_tags;
    
    SPELL_ID                                           SERVICE_LINE_SPELL
    -------------------------------------------------- -------------------------
    100002                                             SD08s
    100003                                               SD23x
    Any ideas guys?

    Something like that?

    update spell_tags
    set service_line_spell = (select max(service_line) keep (dense_rank last order by rank desc)
                              from ranked_spells
                              where spell_tags.spell_id = ranked_spells.spell_ID
                              )
    where spell_ID in (select distinct spell_ID from ranked_spells);
    

    Published by: UW (Germany) on 16.08.2012 16:48 (changed min at the maximum, but it makes only a difference when there is same ranking values)

  • Cut within the specific range

    Hello

    I use MCdaq201 to acquire the signal of a photodiode. What I see in oscilloscope, is a beautiful sinusoid!, exactly what I was expecting. Then, I connect it to PC via MCdaq-USB201, I see a signal which is as he was cut in a specific range. I've attached a screenshot of the output of the program labview and tracerDAQ. Anyone know what could be the reason?

    Thank you

    Petar

    Thanks a lot for all of your helpful tips, YES! We used a preamp between the photodiode and the DAQ hardware and acquired the desired signal.

    And I am really HAPPY!

  • Select Max (Date) in two different tables...

    Dear all,

    I need the date of last update of two different tables, I mean max (date). We will update one table at a time. Updated once I need to take the last update.

    It can be either in table A table B.

    for example.

    Table A

    Date of the ID

    100 16/05/2014

    101 20/05/2014

    102, 22/05/2014

    Table B

    Date of the ID

    100 04/06/2014

    101, 26/05/2014

    102 21/05/2014

    I need the date of table B (101 26/05/2014) last updated date...

    Hello

    Another way, using much more GRAND:

    SELECT LARGER (max1, max2) x

    FROM (SELECT MAX (mydate) max1

    OF mytable_a

    )

    (SELECT MAX (myotherdate) max2

    OF mytable_b

    )

    ;

    Best regards

    Bruno Vroman.

  • Select Max (date) between multiple tables

    I need to retrieve a record from a Table in a set of similar tables with a common "date field". You can select the record where this "date field" value is greater between multiple tables.

    Here, any help is appreciated.  Thank you in advance.

    FOR EXAMPLE

    No. EMP is the primary key.

    Again, each table can have multiple records for EMP n ° 1

    TABLE1:

    FIRST NAME

    FAMILY NAME
    THE EMP NO.

    BASE SALARY

    DATE_FROM

    TABLE 2

    FIRST NAME

    FAMILY NAME
    THE EMP NO.

    SALARY GRADE

    DATE_FROM

    TABLE 3

    FIRST NAME

    FAMILY NAME
    THE EMP NO.

    COMPENSATION

    DATE_FROM

    Hello

    Said Knani, if you use the current design of the table, then here is a way to do what you want:

    WITH union_data AS

    (

    SELECT MAX (base_salary) AS sal FROM table1 UNION ALL

    SELECT MAX (grade_salary) table2 UNION ALL

    SELECT MAX (compensation) FROM table3

    )

    SELECT MAX (sal) AS max_sal

    Of union_data

    ;

  • "selection of object by the path only" in Indesign?

    Hi, I have just changed to cs4 to 5.5 and can't seem to select an object, if it is another, even if the top element of a 'none' was complete. I know that I can hold cmd and select "via" objects but in cs4, I didn't need to do it as long as the top item had no fill. This preference can be enabled/disabled through the "selection of object by the path only" checkbox in illustrator, but I can't seem to find it in Indesign. Maybe I'm lazy who want to simply do not press the cmd button but it's just annoying the hell out of me for any clarification would be much appreciated.

    Ant.

    Hey Ant,.

    You use the 'Frame' Rectangle tool or the tool 'Rectangle '? I find that I selected the 'Frame' Rectangle tool, it will always be the selected object, even if it has no fill; using the "Marquee" tool, if it has no fill, you can select the objects below it without going through CMD-click.

    Hope that helps,

    See you soon!

    Mikey

  • SELECT MAX (FILE_VERSION)

    I put the following portion of the code in a WHERE clause:
               AND PCMS_CHDOC_ACTION_DESC_2.FILE_VERSION IN 
    
                      (SELECT MAX(FILE_VERSION) 
    
                         FROM PCMS_CHDOC_ACTION_DESC PCMS_CHDOC_ACTION_DESC_4
    
                       WHERE PCMS_CHDOC_ACTION_DESC_4.CH_UID = PCMS_CHDOC_DATA_2.CH_UID                                                                              AND PCMS_CHDOC_ACTION_DESC_4.CH_DOC_ID = PCMS_CHDOC_DATA_2.CH_DOC_ID)
    .. .but for records where the FILE_VERSION is null or doesn't retrieve any record.

    There is a way to write such can also retrieve records that are null?
    AND (PCMS_CHDOC_ACTION_DESC_2.FILE_VERSION IN
                      (SELECT MAX(FILE_VERSION)
                         FROM PCMS_CHDOC_ACTION_DESC PCMS_CHDOC_ACTION_DESC_4
                      WHERE PCMS_CHDOC_ACTION_DESC_4.CH_UID = PCMS_CHDOC_DATA_2.CH_UID
                                    AND PCMS_CHDOC_ACTION_DESC_4.CH_DOC_ID = PCMS_CHDOC_DATA_2.CH_DOC_ID
                                  ) OR PCMS_CHDOC_ACTION_DESC_2.FILE_VERSION IS NULL)
    

    or doesn't exist doesn't retrieve any record.
    

    What do you mean by that?
    * 009 *.

    Published by: 009 April 16, 2010 12:14 AM

  • Select max (length) - how to display the length of a group MAX

    Hello

    I have a table with the name of DVD and names of files on the DVD.
    I would like to know how to change this query to get another column, MAX_LENGHT, the MAXIMUM length of the name of FILE to a DVD of return
    This doesn't work request
    select DVD, FILENAME, (SELECT max(length(FILENAME)) / 2 + 4 FROM TABLE) AS MAX_LENGHT from TABLE
    DESIRED RESULT
    DVD    FILENAME     MAX LENGHT
    DVD1     Alina     8
    DVD1     Aidan     8
    DVD1     Aiden     8
    DVD1     Akira     8
    DVD1     Alex     8
    DVD1     Alyssa     8
    DVD1     Arianna     8
    DVD1     Ashley     8
    DVD1     Ava     8
    DVD1     Benjamin8
    DVD1     Bianca     8
    DVD1     Blake     8
    DVD1     Brandon     8
    DVD1     Brayden     8
    DVD1     Brayden     8
    DVD1     Brianna     8
    DVD1     Brielle     8
    DVD1     Brooklyn8
    DVD2     Dakota     11
    DVD2     Dalia     11
    DVD2     Daniel     11
    DVD2     Dante     11
    DVD2     David     11
    DVD2     Diego     11
    DVD2     Dingbang11
    DVD2     Dominic     11
    DVD2     Dylan     11
    DVD2     Chase     11
    DVD2     Chloe     11
    DVD2     Christopher     11
    DVD2     Claire     11
    DVD2     Cole     11
    DVD2     Connor     11
    Thank you

    Roseline

    You can use the analytic version of the function max:

    SELECT  DVD
    ,       FILENAME
    ,       MAX(LENGTH(FILENAME)) OVER (PARTITION BY DVD) AS MAX_LENGTH
    FROM    TABLE
    
  • HELP! : SELECT &amp; MAX

    I had a few difficulties to do a sql query.

    Table 1: Master

    2 columns: name, Contact_ID
    Name1, contact_id_1
    name 2, contact_id_2
    name 3, contact_id_3

    ...

    Table 2: details
    2 columns: Version Contact_id, address,.
    contact_id_1, address_a, 1
    contact_id_1, address_b, 2
    contact_id_2, address_c, 1
    contact_id_2, address_d, 2
    contact_id_2, address_e, 3
    contact_id_3, address_f, 1
    ......

    Question I have:

    How can I make a query showing the list of names with the address with the latest version?

    Result: I'm looking:

    Name1, address_b
    name 2, address_e
    name 3, address_f
    .......

    --------------------------

    Thank you very much for the help in advance!
    with master as
    (
      select 'name1' as name, 'contact_id_1' as contact_id from dual union all
      select 'name2' as name, 'contact_id_2' as contact_id from dual union all
      select 'name3' as name, 'contact_id_3' as contact_id from dual
    ),
    detail as
    (
      select 'contact_id_1' as contact_id, 'address_a' as address, 1 as version from dual union all
      select 'contact_id_1' as contact_id, 'address_b' as address, 2 as version from dual union all
      select 'contact_id_2' as contact_id, 'address_c' as address, 1 as version from dual union all
      select 'contact_id_2' as contact_id, 'address_d' as address, 2 as version from dual union all
      select 'contact_id_2' as contact_id, 'address_e' as address, 3 as version from dual union all
      select 'contact_id_3' as contact_id, 'address_f' as address, 1 as version from dual
    )
    --
    -- end of test data, query is below
    --
    select m.name,
           d.address
    from   master m,
           detail d
    where  m.contact_id = d.contact_id
    and    d.version = (select max(version) from detail d2 where d2.contact_id = d.contact_id)
    /
    
    NAME  ADDRESS
    ----- ---------
    name1 address_b
    name2 address_e
    name3 address_f 
    
    3 rows selected
    

    Published by: Cyn on December 17, 2009 16:39

  • Listing of the items only from a specific range

    Hello

    I have a list of about 100 pages, each of them using date_create variable to the date, they were entered in the database; These entries are the years 2005 to 2008. I need the list of those of the last only six months, but without Hardcoding specific values, then it automatically displays the correct list. Could someone edit me the code for this?

    The code I am using right now is:

    < name cfquery = "disp_news_arti_curr" datasource = "" #Request.MainDSN # "CACHEDWITHIN =" #CreateTimeSpan (1,0,0,0) #">"
    SELECT
    URL, name_pub, date_create, author_pub, id_news_arti, title
    Of
    data_news_arti
    WHERE
    "status = 1 AND date_create > = ' 01 Sep 2005.
    ORDER BY
    date_create DESC
    < / cfquery >

    Thank you
    [email protected]

    Thank you for all your help. I inherited this web site focused on CF and have very little knowledge of this technology.

    I was able to apply some of your comments to change the code. Here's the final copy:


    SELECT the url, name_pub, date_create, author_pub, id_news_arti, title
    OF data_news_arti
    Situation WHERE = 1 AND date_create > = #last_six_months #.
    ORDER BY DESC date_create

    Thank you very much.
    jstama

  • Find the number in a specific range

    Hello

    I have a requirement where I need to check the lower and upper
    'Beach' for specific number. The range has increased by 0.05

    Example:


    Range:
    0.05
    0.1
    0.15
    0.2
    0.25
    0.3
    0.35


    So if I am provided number tell 0.29, I must return under
    outout


    Number Low_range High_range
    0.29 0.3 0.2
    0.13 0.15 0.1


    How can I do this via oracle sql? I tried both options but
    nothing seems to work.


    Any help would be appreciated

    Published by: 1002048 on April 23, 2013 15:00

    Hello

    Welcome to the forum!

    Oracle has two very practice of built-in functions, FLOOR and CEIL, that return the nearest integer, no more than not, or not less than a given number. Is there a way that we can take advantage of these features? Yes! They deal with a range of 1.00, and you have the beaches de.05 or 1/20 that size. Thus magnify your numbers by a factor 20, use CEIL and FLOOR and then narrow results by a factor of 20, like this:

    SELECT  n
    ,     FLOOR (n * 20) / 20    AS low_range
    ,     CEIL  (n * 20) / 20    AS high_range
    FROM     table_x
    ;
    

    To test this, I created a test table:

    CREATE TABLE     table_x
    (
         n     NUMBER
    );
    
    INSERT INTO table_x (n) VALUES (.29);
    INSERT INTO table_x (n) VALUES (.13);
    COMMIT;
    

    You should post examples of data like this whenever you have a question.

    I got these results from these data:

    `        N  LOW_RANGE HIGH_RANGE
    ---------- ---------- ----------
           .29        .25         .3
           .13         .1        .15
    

    Moreover, it is better to ask questions like that are on the language SQL, PL/SQL, and SQL
    See the FAQ for this forum {message identifier: = 9360002}

Maybe you are looking for

  • iOS 9.3

    Hi all I use an Iphone 5 s 64GB and I was very happy with it. But it turns into a mess since ios 9.3. (13E233). Now, I have the following problems: not possible to open links in Safari and other applications; not possible to use Napster more == > no

  • in firefox 4, I don't have the option to save image then right click on a photo in facebook. my friends say they do. Why can I not?

    I have windows xp and start using firefox, I'm very happy with firefox but in IE I always pick up pictures of family and friends on facebook. That is to say all I do is right click on the image and choose Save image as in firefox, but that I don't ha

  • Satellite Pro A200 does not start

    Hello I have an A200 with XP PRO installed.After a defrag routine and restart the laptop when starting BACK gets to my page of the screensaver then made noise off closing down. No toolbar appears is just all right tomy log in page and I have to stop

  • How can I delete Music player from the control center!

    Control Center (hit upward at the home screen) contains a music player control. I want this thing out of here. I rarely play music on my iPhone. And I find that thing handheld game. I find that I didn't ask to play music. And the music app does not a

  • R6200 caps than ethernet wired 200 Mbps of download speed

    I recently updated my home ISP service in the service of Time Warner 300mbps. If I make a wired connection to the modem cable from the ISP, I can reach the speed of 300mbps advertised, so I get what I pay for my provider. However, when I connect the