Choose the date of the last

Hi all

I want to ask that I had a column called readingtimestamp and it has about 40 lines, but I want to select the last date given and as matter of fact that he should give me an answer. How I do that?

Concerning

Try this

select column1,column2,readingtimestamp from
(
select column1,column2,readingtimestamp,row_number() over (order by readingtimestamp desc) rn
from table_name) a
where a.rn = 1;

Tags: Database

Similar Questions

  • How to choose the last rate in SQL?

    Dear friends,

    I have a table named pr_master

    There are the item_id, pr_date, and item_rate fields in the table

    data are as below

    item_id pr_date item_rate

    21 01/01/2014 50

    21 01/05/2014 45

    01/09/2014 21, 44

    01/05/2014 25, 115

    15/01/2014 25, 110

    17/01/2014 25, 125

    I want the maximum date through SQL for specific item rate.

    Any1 can help. Thanking you.

    Kind regards

    with

    pr_master as

    (select 21 item_id, to_date('01-01-2014','dd-mm-yyyy') pr_date, 50 item_rate union double all the)

    Select 21, to_date (May 1, 2014 "," dd-mm-yyyy ""), 45 union double all the

    Select 21, to_date (September 1, 2014 "," dd-mm-yyyy ""), 44 Union double all the

    Select 25, to_date (May 1, 2014 "," dd-mm-yyyy ""), 115 union double all the

    Select 25, to_date (15 January 2014 "," dd-mm-yyyy ""), 110 union double all the

    Select 25, to_date (January 17, 2014 "," dd-mm-yyyy ""), 125 of the double

    )

    Select item_id, pr_date, item_rate

    of (item_id, pr_date, item_rate, row_number (select) on rn (partition by item_id arrested by pr_date desc)

    of pr_master

    )

    where rn = 1

    ITEM_ID PR_DATE ITEM_RATE
    21 09/01/2014 44
    25 17/01/2014 125

    Concerning

    Etbin

  • Select the last date

    Hello

    I have a table that looks like this:

    no date of activity
    1 sport 2008-11-23
    2 bike 12/15/2008
    3-Dy free 01/05/2009


    How to choose the last day in the table above? I tried this:

    Select the activity of tbl_above
    where < < date is the last > >

    I want back the 'activity' only, so I got to put the 'check' the ' where clause'

    Any idea?

    Please see this...

    SQL > select * from emp;

    EMPNO, ENAME, JOB HIREDATE DEPTNO COMM SAL MGR
    ---------- ---------- --------- ---------- --------- ---------- ---------- ----------
    7369 SMITH COMMITTED 7902 17 DECEMBER 20 800 80
    7499 ALLEN 7698 1600 20 FEBRUARY SALESMAN 81 300 30
    7521 WARD 7698 1250 22 FEBRUARY SALESMAN 81 500 30
    7566 JONES MANAGER 7839 2975 2 APRIL 81 20
    7654 MARTIN 7698 28 - SEP - 81 1250 1400 30 SALESMAN
    7698 BLAKE MANAGER 7839 2850 MAY 1, 81 30
    7782 CLARK MANAGER 7839 2450 JUNE 9 81 10
    7788 SCOTT ANALYST 7566 3000 APRIL 19, 87 20
    PRESIDENT OF 7839 17 NOVEMBER KING 81 5000 10
    7844 TURNER 7698 08 - SEP - 81 1500 0 30 SALESMAN
    7876 ADAMS 7788 1100 23 MAY CLERK 87 20

    EMPNO, ENAME, JOB HIREDATE DEPTNO COMM SAL MGR
    ---------- ---------- --------- ---------- --------- ---------- ---------- ----------
    7900 7698 DECEMBER 3, CLERK JAMES 81 950 30
    7902 7566 3000 3 DECEMBER ANALYST FORD 81 20
    7934 MILLER COMMITTED JANUARY 7782 1300 23 82 10
    1-1-10

    15 selected lines.

    SQL > select empno from emp where hiredate = (select max (hiredate) from emp);

    EMPNO
    ----------
    7876

    SQL >

    Concerning

  • getting the last area for each case

    Hello all;

    I have a table with the following information below
    create table tmp_a
    (
           idv number(30),
           personid number(30),
           Area varchar2(200),
           dateadded date,
           is_close number(2)
    );
    
    insert into tmp_a
      (idv, personid, area, dateadded, is_close)
    values
      (1, 10001, 'ZONE_A', sysdate, 1);
      
    insert into tmp_a
      (idv, personid, area, dateadded, is_close)
    values
      (2, 10002, 'ZONE_B', sysdate, 0);
      
    insert into tmp_a
      (idv, personid, area, dateadded, is_close)
    values
      (3, 10003, 'ZONE_A', sysdate, 0);
    
    insert into tmp_a
      (idv, personid, area, dateadded, is_close)
    values
      (4, 10003, 'ZONE_A', sysdate, 0); 
      
    Now, I'd like to get this below
    idv   Personid   Area        Dateadded                           Is_clode
    4       10003   Zone_A     3/3/2011 1:00:37PM               0
    2       10002   Zone_B     3/3/2011 12:17;14PM              0
    the output is based on the fact if there are duplicates associated with the area, the query should choose the last... In this case, the last being for zone_A is idv 4.
    Please note, idv is a primary key. How can I do this? Any help is appreciated. Thank you.
    select  max(idv) keep(dense_rank last order by dateadded,idv) idv,
            max(personid) keep(dense_rank last order by dateadded,idv) personid,
            area,
            max(dateadded) dateadded,
            max(is_close) keep(dense_rank last order by dateadded,idv) is_close
      from  tmp_a
      group by area
      order by area
    /
    
           IDV   PERSONID AREA                           DATEADDED             IS_CLOSE
    ---------- ---------- ------------------------------ ------------------- ----------
             4      10003 ZONE_A                         03/03/2011 13:12:50          1
             2      10002 ZONE_B                         03/03/2011 13:12:50          0
    
    2 rows selected.
    
    SQL> 
    

    SY.

  • How to select only the last child nodes in a piece of XML via XMLTABLE?

    Hello

    I use Oracle 10.2.0.4.

    I have the following XML:
    with sd as (select xmltype('<Fruits>
                                  <Fruit>
                                    <FruitType>Apple</FruitType>
                                    <FruitSubtype>Granny Smith</FruitSubtype>
                                  </Fruit>
                                  <Fruit>
                                    <FruitType>Pear</FruitType>
                                    <FruitSubtype>Anjou</FruitSubtype>
                                  </Fruit>
                                  <Fruit>
                                    <FruitType>Pear</FruitType>
                                    <FruitSubtype>Comice</FruitSubtype>
                                  </Fruit>
                                  <Fruit>
                                    <FruitType>Plum</FruitType>
                                    <FruitSubtype>Victoria</FruitSubtype>
                                  </Fruit>
                                  <Fruit>
                                    <FruitType>Apple</FruitType>
                                    <FruitSubtype>Bramley</FruitSubtype>
                                  </Fruit>
                                </Fruits>') fruit_xml from dual)
    select *
    from   sd;
    and I want to choose the last child nodes where the FruitType is Apple or pear.

    So far, I've got:
    with sd as (select xmltype('<Fruits>
                                  <Fruit>
                                    <FruitType>Apple</FruitType>
                                    <FruitSubtype>Granny Smith</FruitSubtype>
                                  </Fruit>
                                  <Fruit>
                                    <FruitType>Pear</FruitType>
                                    <FruitSubtype>Anjou</FruitSubtype>
                                  </Fruit>
                                  <Fruit>
                                    <FruitType>Pear</FruitType>
                                    <FruitSubtype>Comice</FruitSubtype>
                                  </Fruit>
                                  <Fruit>
                                    <FruitType>Plum</FruitType>
                                    <FruitSubtype>Victoria</FruitSubtype>
                                  </Fruit>
                                  <Fruit>
                                    <FruitType>Apple</FruitType>
                                    <FruitSubtype>Bramley</FruitSubtype>
                                  </Fruit>
                                </Fruits>') fruit_xml from dual)
    select x.*
    from   sd,
           xmltable('//Fruits/Fruit[FruitType=''Apple'' or FruitType=''Pear'']'
                   passing sd.fruit_xml
                   columns fruit_type VARCHAR2(25) path '//FruitType',
                           fruit_subtype VARCHAR2(25) path '//FruitSubtype') x;
    
    FRUIT_TYPE                FRUIT_SUBTYPE
    ------------------------- -------------------------
    Apple                     Granny Smith
    Pear                      Anjou
    Pear                      Comice
    Apple                     Bramley
    but I just want to finish with the last child node by FruitType, for example:
    FRUIT_TYPE                FRUIT_SUBTYPE
    ------------------------- -------------------------
    Pear                      Comice
    Apple                     Bramley
    Is it possible to do through XMLTABLE, or I have to number each of the lines that results from (what I know how to do) and then create a group to prove XMLTABLE? The latter seems awkward to me, so I'd avoid it if possible, but if this is the way to go, I can do it.

    Thank you.

    Is it possible to do through XMLTABLE, or I have to number each of the lines that results from (what I know how to do) and then create a group to prove XMLTABLE?

    Indeed, it is a possible way:

    select x.fruit_type,
           min(fruit_subtype) keep(dense_rank last order by rn) as fruit_subtype
    from   sd,
           xmltable('/Fruits/Fruit'
                   passing sd.fruit_xml
                   columns fruit_type VARCHAR2(25) path 'FruitType',
                           fruit_subtype VARCHAR2(25) path 'FruitSubtype',
                           rn for ordinality) x
    where fruit_type in ('Apple','Pear')
    group by fruit_type
    ;
    

    Other options, should push the logic of consolidation in the XQuery:

    select x.*
    from sd,
         xmltable('/Fruits/Fruit[FruitType="Apple"][last()] |
                   /Fruits/Fruit[FruitType="Pear"][last()]'
                  passing sd.fruit_xml
                  columns fruit_type VARCHAR2(25) path 'FruitType',
                          fruit_subtype VARCHAR2(25) path 'FruitSubtype'
         ) x
    ;
    

    or,

    select x.*
    from   sd,
           xmltable('for $i in distinct-values(/Fruits/Fruit/FruitType)
                     return /Fruits/Fruit[FruitType=$i][last()]'
                   passing sd.fruit_xml
                   columns fruit_type VARCHAR2(25) path 'FruitType',
                           fruit_subtype VARCHAR2(25) path 'FruitSubtype'
                           ) x
    where x.fruit_type in ('Apple','Pear')
    ;
    

    or,

    select x.*
    from   sd,
           xmltable('/Fruits/Fruit[not(following-sibling::Fruit/FruitType=./FruitType)]'
                   passing sd.fruit_xml
                   columns fruit_type VARCHAR2(25) path 'FruitType',
                           fruit_subtype VARCHAR2(25) path 'FruitSubtype'
                           ) x
    where x.fruit_type in ('Apple','Pear')
    ;
    

    Edited by: odie_63 APR 17. 2012 17:56 - added latest example

  • AppleScript: enter the "last modified" or other file dates

    Is it possible to enter the "last modified" a file, and then open the file and paste this date into a specific location?

    The issue is that in figures (v2 and v3) and Pages (v4 and v5).

    My hypothesis involved in the sequence above is that the date is applied to the file when it is saved, then the script would need to save the file, get the date, open the file and coller, paste to a location specified, then close the file (which would then a last modified date somewhat later than pasted.

    Kind regards

    Barry

    It is trivial to get the date of the change of a file:

    Set myFile to (Choose file)

    say application "System events" to get modification date of myFile

    Now you have a date object. Insert the data in the file, however, requires more details.

    For one, you will need to ensure that you are actually check a .numbers file. If you get that you can easily open the file:

    say application 'Numbers' to Open myFile

    where to add the data, but is another question - how do you know where you want to place the data?

  • Will be able to choose only the last the last row in a window/desktop icon in Windows 7

    I use my laptop with Windows. Recently I could not open the icons/files you want in the Office of a window.

    I may be able to choose only the last the last row in a window/desktop icon in Windows 7.
    Although double-clicking on an icon only the last icon in the window opens. Pls help me...

    Hi Peter,.

    1 when was the last time that the desktop icons worked?

    2. you have any security program installed on the computer?

    3. don't you face any performance issues on the computer?

    4 did you a recent software or changes to the material on the computer?

    Method 1:

    I would say allowing you to run the FIXIT from the link provided and check.

    Difficulty of broken desktop shortcuts and common system maintenance tasks

    http://support.Microsoft.com/mats/system_maintenance_for_windows/en-us

    Method 2:

    If the problem persists, you can also run the Scanner security Microsoft and check all infections.

    http://www.Microsoft.com/security/scanner/en-us/default.aspx

    Note: there is a risk of data loss if all the files are infected and which can be removed in the cleaning process.

    Method 3:

    I also suggest to try to run the System File Checker scan on the computer. The scan will replace all the Windows files corrupted with new ones.

    Click on the link mentioned below for further guidance on the scanning of the file system Checker

    http://support.Microsoft.com/kb/929833

    Hope this helps and let us know if you need more assistance. We will be happy to help you.

  • Select the last Date of multicolumn and its value adjustent cust_id

    I have a Table with 5 customer_id and 5 Dates with each belonging to its cust_id.

    I need to take the last, in my example would be CUSTID_5.  I know

    this with the GREATEST who select the CHANGE_DATE_5 (in my example), but

    How to choose the CUSTID_x? that goes along with the winning Date?

    create table test_tbl)

    number of custid_1

    date of change_date_1,

    number of custid_2

    date of change_date_2,

    number of custid_3

    date of change_date_3,

    number of custid_4

    date of change_date_4,

    number of custid_5

    date of change_date_5

    );

    INSERT INTO test_tbl

    (CUSTID_1, CHANGE_DATE_1, CUSTID_2, CHANGE_DATE_2, CUSTID_3, CHANGE_DATE_3, CUSTID_4, CHANGE_DATE_4, CUSTID_5, CHANGE_DATE_5)

    VALUES

    (111, sysdate, 222, sysdate + 1, 333, sysdate + 2, 444, sysdate + 3, 555, sysdate + 4);

    commit;

    Hello

    Here's one way:

    WITH unpivoted_data AS

    (

    SELECT custid, change_date

    , EVALUATE () OVER (ORDER BY change_date DESC) AS r_num

    OF test_tbl

    UNPIVOT ((custid, change_date)

    Label ((custid_1, change_date_1) AS 1)

    , (custid_2, change_date_2) AS 2

    , (custid_3, change_date_3) AS 3

    , (custid_4, change_date_4) AS 4

    , (custid_5, change_date_5) AS 5

    )

    )

    )

    SELECT custid, change_date

    Of unpivoted_data

    WHERE r_num = 1

    ;

    Having several columns for several occurrences of basically the same thing is a bad table.  This problem would be much simpler, but also more effective if each pair custid/change_date has been strored on a separate line.  In addition, you would not be limited to 5 pairs.

  • Find the last valid value in a date range

    The data I work with represents readings from different instruments. A follow-up field of a sum running while this number continues to increase. I need to look at the data for a particular date, but the problem is that sometimes the instrument is turned off. In this case there is no data for that date, however since all I want is the total sum for the signal on this instrument, I need to keep going until I find the latest valid data in the database that would represent the sum up to this point. How can I design a query or procedure that would deal with this eventuality? Some examples of data:
    PV_ID                  SMPL_DTE                  INTEG_SINCE_VAL 
    ---------------------- ------------------------- --------------- 
    271                    20-JUL-08 12.05.00 AM     6172.0387459767 
    271                    20-JUL-08 12.06.00 AM     6172.0387459767 
    271                    21-JUL-08 12.05.00 AM     6172.0387459767 
    271                    21-JUL-08 12.06.00 AM     6172.0387459767 
    271                    21-JUL-08 08.43.00 AM     6172.0387459767 
    271                    21-JUL-08 08.45.00 AM     6172.0387459767 
    271                    22-JUL-08 12.05.00 AM     6172.0387459767 
    271                    12-AUG-08 04.45.00 PM     6172.0387459767 
    271                    12-AUG-08 04.50.00 PM     6172.038748687284 
    So, if for example I run a query for July 30, I would need to get the result of the July 22 because it is the last valid number. PV_ID represents the ID of the instrument and the INTEG_SINCE_VAL of the total cumulative for signal readings on this instrument.

    Published by: Solerous on March 16, 2009 07:23

    Published by: Solerous on March 16, 2009 07:25

    Hello

    If you want the last row or before a given date of the target as on July 30, 2008)?

    Here's a way

    SELECT  *
    FROM    (
            SELECT    *       -- or whatever columns you want
            FROM      table_x
            WHERE     sample_dte < TO_DATE (:target_dte, 'DD-MON-RR') + 1     -- See note below
            ORDER BY  sample_dte DESC
            )
    WHERE   ROWNUM = 1;
    

    NOTE: the above query adds a day to the current deadline, but selects the lines that are less important (not equal to) that link, so if you enter 30 July 08, it compares against 31 July 08, so he would choose anything on the date target itself, no matter what time. In other words, if you ask 30 July 08, you could get something later than 30 July 08 23:59:59, but you wouldn't get 31 July 08 12:00:00 AM.

  • How display the date of my last update of OSX in my Mac?

    How display the date of my last update of OSX in my Mac?

    If it was in the last 30 days, the updates will often (not always) show the Mac App store on your page of updates, under the heading "updates installed in the last 30 days.

  • Do the numbers tell me the last date of a cell containing specific text

    Hi guys,.

    I'm setting up a pilot logbook and I need to keep track of when I lead some approaches to the instruments for the purposes of recency.

    For example, the last time I did a VOR approach was April 20, 16.  I need the numbers to recognize the "VOR" text and give me the corresponding date.  I'm having numbers give me this date in a separate table.

    Any ideas on how to do this would be greatly appreciated.

    Thank you!

    Hi Walter,

    This is a roundabout way. Perhaps another user will display a more elegant way.

    Table 1 is a version abridged your journal of driving. Here is table 2:

    Table 2 uses the SIERREUR function to place "" (NULL) if the SEARCH fails to find a match between the value in the header line and an entry in the log of your flight.

    Otherwise, it inserts a value (The FIND returns the starting position of a string in another).

    Now we've found BK VOR (and fill to the right) and SID.

    Columns needed for approaches more more!

    Table 3 is a Date of any cell in table 2 which is not "" (NULL).

    Formula in A2 (and fill down and fill the right)

    = IF(Table 2::A2≠"",Table 1::$A2,"")

    You can type this than = IF (table 2::A2 <>"", Table 1: $A2, "")

    3 numbers will change <>≠

    Formula of the cell footer of table 3 (for column A, then fill to the right)

    = MAX (A)

    To improve the 'presentation', move (copy / paste) 2 Table to another worksheet (TAB). The formulas will adjust automatically.

    Happy flying!

    Kind regards

    Ian.

  • Since the last system upgraded my menu bar top with wifi and time, date etc etc is hidden unless I have sulk my cursor on it. Same thing with apps from shingles. How can I restore it is always there?

    Since the last system upgraded my menu bar top with wifi and time, date etc etc is hidden unless I have sulk my cursor on it. Same thing with apps from shingles. How can I restore it is always there? bar menus hidden-how do I restore?

    SystemPreferences-> Dock: automatically hide / show Dock

    SystemPreferences-> general: automatically hide / show menu bar

  • My 2 TB TC is full and will not back up. Yet, I have only 1 TB of data on my laptop. Note that I've reformatted the laptop since the last backup with a clean installation of El Capitan.

    My 2 TB Time Capsule is full and will not save. Yet, I have only 1 TB of data on my laptop. Note that I've reformatted the laptop since the last backup with a clean installation of El Capitan.

    I bought a 2 TB external hard and have used Time Machine to back up. But I also use my time Capsule, which I save wireless.

    Any suggestions on getting my TC back up?

    One suggestion would be to copy all existing backups that are now on the Time Capsule 2 TB hard disk. Then, clear the TC and start over again with new backups.

    A more expensive option... assuming you want to keep all old backups on the TC... would be to add a new TC and start backups goes in this direction.

    Another option... If you do not need to keep all old backups now on the TC... would be to erase the TC and start over again with new backups. The benefit of doing this would be that no new material will be necessary, but the downside would be that you lose your old backup history.

  • Why the last OS update cost me gigabytes of data when you are connected directly to my computer and ISP via Itunes February 29, 2016

    Why the last OS update cost me gigabytes of data when you are connected directly to my computer and ISP via Itunes.  29 February 2016

    While it is connected to ITunes via my Dell system, I was informed of the latest OS update for my IPhone 6.  I decided that the direct connection to the internet would be the fastest way to download and install the software.  During the process I started to have some warning of our AT & T account that I approach the limit of our data plan, then in quick succession, only warnings, said I've reached the limit and then passed in the data, limit charges.  At the time it was done, I had accumulated more than 2 gigabytes of additional data charges.

    Until that point, I was very pleased with the device and confident in the ability to use Wifi and data.  Due to this incident, I became very suspicious of the camera and the huge potential for data overcharges. It is extremely disconcerting as it happened while it is directly connected to the internet using my computer at home.

    Please note that, in the episode my ISP and the computer is remained connected to the WEB with no sign of connectivity issues.

    Someone at - he had a similar experience and understand what went wrong?

    Thanks for your support,

    Jerry

    JerrolK wrote:

    Why the last OS update cost me gigabytes of data when you are connected directly to my computer and ISP via Itunes.  29 February 2016

    While it is connected to ITunes via my Dell system, I was informed of the latest OS update for my IPhone 6.  I decided that the direct connection to the internet would be the fastest way to download and install the software.

    You have chosen the option of direct download, you have received a message of warning from AT & T about it yet.

    He did what you asked it to do.

  • will choose the manually back option in iTunes backup everything that is on my iPhone to my computer? Including the app data

    Not a problem just a question. I intend to sell my apple iPhone, it's not compatible with my new wireless network. I can't afford to buy an iPhone outright at the moment, but I plan in the future. I want to backup everything on my iPhone to my Mac so that I can restore the data to a new iPhone later. The current iPhone 5 is already set to save important things to iCloud, if I choose the option with a manual backup encryption will be that record everything, including all the data from the app? Sorry if this is a stupid question, I want to just make sure I have everything before you send the iPhone.

    Hello CallRinny,

    I understand that you have a question about your iTunes backups and that you should use. Back on which covers.

    In general, an iTunes backup will cover pretty much everything on your iPhone. The best thing to watch over it, it's what doesn't iTunes back upwards and which covers the encrypted backup. Take a look at the information below to clarify this. I would also do that applications will be recorded in your iTunes library, so when you restore your backup, apps will sync back to the wire in one sitting instead to download on the App Store.

    On safeguards in iCloud and iTunes
    https://support.Apple.com/en-us/HT204136

    backup iTunes

    On your Mac or PC, you can make a backup of your device in iTunes. Synchronize your device with your computer is not the same as performing a backup.

    An iTunes backup includes almost all settings and data from your device. An iTunes backup does not include:

    • Content of the iTunes and App Store or directly downloaded from iBooks PDF files (you can save this content using transfer purchases in iTunes.)
    • Synchronized content from iTunes, as imported MP3s or CDs, videos, books and photos
    • Photos already stored in the cloud, like My Photo Stream and iCloud photo library
    • Tap Settings ID
    • Settings and information Apple pay
    • Data activity, health, and keychain (to save this content, you will need to use iTunes backup encrypted ).

    Learn How to perform backups in iTunes, how to find them on your Mac or PC, and how to delete backups you no longer need.

    Let me know if this clears it for you.

    Take care

Maybe you are looking for

  • While a 20-b013W: replacement hard drive

    Machine bought 8/2013. Hard drive failed under warranty 8/2014 (replaced by HP). Hard drive failed once again (short hard drive DST failure).  Cost is too high for me someone pay so I try to replace the hard disk drive me.  What should I replace it w

  • Podcast archives

    If archive org is down, would that mean that my no t podcast will appear on Itunes until archive works again? I have my podcast archive and tumblr and everything worked ok, but I m one is not an expert, I've done the job right after the tutorials. Po

  • Problems of unit change

    Hello, how can I do to change the number corresponding to the unit changed in the table? For example, when I change the unit of 'flow' to be L/h, the value should appear 4 240 in the course of data without altering the value manually. It should appea

  • Scanner printer (kodak ESP 9250) DRIVER UNAVAILABLE

    I get an error message saying driver not available for my scanner on my KODAK printer.

  • I can't send the default language in the windows of Spanish into English.

    I opened the Control Panel, cliked on config and language of the region, has chosen English as the language.  and the United States as a region. Under administration I clicked copy config and it shows Spanish as a language of show. I am very confused