Select the max record on date, but not today

Hi all,
I have this table
Access
codi_uten number(9)
data_acce DATE
and for
select data_acce from Access
the codi_uten=3041
order by data_acce;
this is the result
DATA_ACCE
29-OTT-07
05-NOV-07
09-NOV-07
09-NOV-07
09-NOV-07
16-NOV-07
23-NOV-07
23-NOV-07
20-DIC-07
20-DIC-07
Where 20-Dic-07 is today ;)
I need a statment that can give me only the last data value (in this format dd/mm/yyyy) but it cannot consider today.
It's possible without use the RowId?
Thank's
Paolo from Madrid

No, you don't need rowids.
Creating an example table:
create table t
( id number primary key,
  day  date);
insert into t values(1, sysdate);
insert into t values(2, sysdate-1);
insert into t values(3, sysdate-2);
insert into t values(4, sysdate-3);Looking all rows:
select * from t
ID                                       DAY                 
1                                        12/20/2007 10:24:28 A
2                                        12/19/2007 10:24:28 A
3                                        12/18/2007 10:24:28 A
4                                        12/17/2007 10:24:28 A
4 rows selectedFind the last row, except rows with day = today
select *
from t
where day = (select max(day)
           from t
             where day < trunc(sysdate))
ID                                       DAY                 
2                                        12/19/2007 10:24:28 AAnd, finally, formating the data
select id, to_char(day, 'dd/mm/yyyy')
from t
where day = (select max(day)
           from t
             where day < trunc(sysdate))
ID                                       TO_CHAR(DAY,'DD/MM/YYYY')
2                                        19/12/2007      Merry Xmas,
Miguel

Similar Messages

  • Need to select the max record in a report

    Dear All,
    I have a certain report which displays the employee records along with their 'empids' and their 'beginning date'. For each 'empid', there are more than one records and hence more than one 'beginning date'. I need to select that record which contains the maximum 'beginning date'. How can this be possible in the reporting level without doing any coding in update rules or writing any exit ?
    Regards,
    Srinivas

    Hi,
    I think it is not possible because  i am having doubt how the for each employ id how it will be different joining dates,i think for each employ having differeent joining dates ,if u want to see maximum number of employs in which in company then we can go for the only option non cumulative kf with maximum value with ur joining date as the reference.but it report level if it is keyfigure we can have options of maximum and minimum and like that we can do but in case of characterstic like employnumber and joiningdate both are characterstics.
    Thanks
    sathsih

  • Is there a way to repeat an activity in the calendar monthly on the same day, i.e., the 2nd Wednesday of each month?  I can repeat on the date but not the day of the month.

    Is there a way to repeat an activity in the calendar monthly on the same day, i.e., the 2nd Wednesday of each month?  ( I can repeat on the date but not the day of the month.)

    Not with the stock calendars app.

  • HT1918 I updated my payment method because I changed my Internet MasterCard of the same number but  new expiry date but not accepted , can you help me

    Please I need help regarding this problem I faced today.
    I updated my payment method because I changed my Internet MasterCard of the same number but  new expiry date but not accepted , can you help me?

    Is the iPhone jailbroken or was jailbroken?. In the article " http://support.apple.com/kb/TS3694 " it says:
    Errors related to downgrading iOS
    The required resource can't be found: This alert message occurs when your device has a newer version of iOS than what is available in iTunes. When troubleshooting a device that presents this alert message, go toSettings > General > About and check the version of iOS on the device. If it's newer than the latest released iOS version, the device may have a prerelease developer version of iOS installed. Installing an older version of iOS over a newer version isn't supported.
    Error 1015: This error is typically caused by attempts to downgrade the software for an iPhone, iPad, or iPod touch. This can occur when you attempt to restore using an older .ipsw file. Downgrading to a previous version isn't supported. To resolve this issue, attempt to restore with the latest iPhone, iPad, or iPod touch software available from Apple. This error can also occur when an unauthorized modification of the iOS has occurred and you're now trying to restore to an authorized, default state.

  • The calendar typeface is so dim, I can barely read it. Name of days and date, but not the items I put in. Apple says they have no fix. Anyone else have this problem? Any solutions?

    The calendar typeface is so dim, I can barely read it. Name of days and date, but not the items I put in. Apple says they have no fix. Anyone else have this problem? Any solutions?

    I agree and I found your post because I did a google search ical typeface dim.
    If I find anything out, I will post back here.

  • I'm actually trying to find the date i visited a site. adding columns allow the order to be sorted but not show a date. Please tell me it there's a way to see t

    I'm actually trying to find the date i visited a site. adding columns allow the order to be sorted but not show a date. Please tell me it there's a way to see the date. the sidebar no longer has the option for date. the most recent only shows the time.

    If you only see the time then that would mean that you see an entry of the current day (today).
    History items from past days should have the date as well in the Most Recent Visit column.
    You should be able to see this changing if you open the last 7 days folder and scroll down.

  • How can I select the random records in u201Cstep loopu201D.

    Hi, Experts,
    I am using step loop to display the data on screen now I want to select the random records from this step loop display. Like 1st 3rd or 5th record, is there any way to select the records,
    like I did in Table control there was a filed in internal table named marked char length 1, I gave this field name in u201Cw/ SelColumnu201D it fill that field with u2018Xu2019 from where I can get the info about the selected records, in this way I can easily perform the operation on that internal table with the help of that marked field.
    Is there any way to select the records in step loop too ?
    Kind Regards,
    Faisal

    thanks for replay shwetali,
    but i just gave you example of random records with 1st 3rd and 5th my goal is not select only these records. i want to select the random mean any records from the step loop display.
    like we can select from the table control. and when select any record it place 'X' in the given internal table field.
    Thanks and kind Regards,
    Faisal

  • Select the one record with the latest record

    I have the following table called tblSales:
    SKU   TransDate   Color
    ===   ======  ====
    123   1/1/2015    Red
    123   1/2/2015    Red
    123   1/5/2015    Red
    123   1/1/2015    White
    123   1/2/2015    White
    123   1/3/2015    White
    123   1/1/2015    Blue
    123   1/2/2015    Blue
    123   1/5/2015    Blue
    I need to create a query along the lines "SELECT the latest record FROM tblSales WHERE Color = 'White''
    In this example, the record dated 1/3/2015 would be the result.  I know that MAX(TransDate) is used here, but not sure how.
    Thanks.
    Ken

    Karl,
    I had already tried that.  It returns all 3 records having SKU = 123 and Color = White.
    Worst case scenario is I can always search for White 123s using a query with TransDate DESC and then get the first record.  I was just hoping for something a bit more elegant.
    Thanks for your help though.
    Ken

  • Sap treasury flow is due before accrual/deferral key date, but not posted

    Hi,
    I run TBB1 - posted business transactions - all transactions posted
    when i run the tbb4 for product type 51a i got the following error
    sap treasury flow is due before accrual/deferral key date, but not posted
    Please see the image

    Hello, Krishna.
    You haven't posted flow types 1150.
    Please go to your transaction, select "Cash flow" tab, Choose layout "106 Posting view", select flow type 1150 (one from your first screenshot above - use flow type and date) and check "Posting status" field - what's inside (please, provide screenshot)?
    NA T2104
    Short Text
    Flow is due before accrual/deferral key date, but not posted
    Diagnosis
    The corresponding flow is due before the accrual/deferral key date, but has not yet been posted; this may result in the incorrect amount of expenses or revenues being displayed in financial accounting.
    System Response
    The flow is treated by the accrual/deferral function as if were already posted, i.e. the related expenses or revenues are accrued/deferred, where appropriate.
    Procedure
    Post the flow to correct the amounts of expenses or revenues shown in financial accounting.

  • How show the last record by date

    Hi Gurus,
    i got in the cube the next records for example:
    calday                  Material    Quantity
    01.01.2011             A                 10
    15.01.2011             A                  20
    if i present in the query these IO an KF the query will show these 2 records, now i want just show the last record by date
    calday                  Material    Quantity
    15.01.2011             A                  20
    i tried in the query with a calculate KF with exception aggregation , MAX with Reference to calday , but this still show both records... how can i do it? help gurus.

    Hello,
    If there are sales occuring for the material on two different dates and you include date in there will be always two records.
    I dont understand the need to show the last transaction. Anyways if you still need that you need to remodel the backend.
    Put a DSO on the cube with date in the data field, this will always overwrite the value for the key combination you need.
    Then you can return on this DSO.
    Regards
    Shashank

  • Data folder can not be opened in finding " AirPort Time Capsule " The operation can not be completed because the original item for " data" does not exist .

    Hi
    I have a " AirPort Time Capsule " (firmware 7.7.3) When I try to open the data folder in "finder". Then I got the message  " The operation can not be completed because the original item for " data" does not exist". I have a lot of data and I can understand why I get this message?
    Anyone who can help? Thanks..
    Br. Bo

    Get a USB drive of 2TB or more.. assuming your TC is 2TB. Either preformatted Mac or plug into your Mac and format it standard Mac OS Extended Journaled in disk utility.
    Do a full archive of the TC. You do this using airport utility. Do not click the erase disk.. I marked in green.. just the archive.. that is to backup the internal disk to the USB disk. It is not fast.. take it that the process will go at around 40-50GB/hr.
    Once you complete the archive .. it is a direct image of the data on your TC.. you can then plug it into your computer directly.. and then try and open the files you lost.. if you cannot open them.. open disk utility and fix the permissions.
    http://osxdaily.com/2015/01/13/repair-disk-permissions-mac-os-x/
    Or try the methods apple recommends..
    OS X Yosemite: Set permissions for items on your Mac
    It is possible to fix things on the USB drive because it is locally mounted.. but you cannot fix it on TC which is network drive.

  • I would like to detect all the keyboard key is okay, but not every key can be detected by using LabVIEW example, keyboard keycode

    I would like to detect all the keyboard key is okay, but not every key can be detected by LabVIEW example ( we can use 『basic input demo.vi』to detect normal key』.
    I want to detect some 『hot key』 for example some keys exist in the upper part like 『search key』、『e-mail key』、『volumn control key』...etc. They are very often to be watched in some new keyboards, but we still don't know how to detect if their functions are okay.
    Can we detect signals of these 『hot key』 in LabVIEW? We can apply these hot key's functions in XP, so we should detect their signal, I think, but I can't do it.
    I serach some information about this question, and somebody said we can detect hot key's signal by grabing 『keybode』 these hot key feedback. But I don't know how to do these. I can't use VC. So anyone can give me a LabVIEW VI to grab keycode? Or any other solution we can detect all the key on the keyboard, including hot keys?
    Thanks!
    Regards,

    Maybe that is the limitation of Acquire Input Data.vi.The vi can't identify the Unformal key.
    You can try to use Event structure and set to listen "key down" event.
    There are two terminals VKey, ScanCode will sent out the information when you press key.
    There are two pictures in attached file, 2.jpg will show you the detail.
    Good luck.
    Attachments:
    SpecialKey.zip ‏17 KB

  • How to select the max rowid from a subquery with group by

    Hi Gurus,
    Kindly help how to fix the following query because I'm getting Oracle error:ORA-01446.
    select * from edy_raw_data a
    where rowid in ( select max(rowid) from(
    select email,max(date_updated) from edy_raw_data b
    where b.email=a.email
    group by email ))
    The query select the max rowid from a sub query with group by.
    Thanks in Advance.
    Benjie

    Why do you need to compare with rowid?
    Wouldn't this suffice?
    select * from edy_raw_data a
    where (email,date_updated) = (select email, max(date_updated) from edy_raw_data b
                        where b.email=a.email
                        group by b.email ))* Note: untested

  • When I make a video with the camera ipad mini seen but not heard I can do ?

    when I make a video with the camera ipad mini seen but not heard I can do ?

    Yeah, of course you can. All you do is, open PhotoBooth, record your video and then, once you have stopped the video recording just drag the movie out of the bottom of PhotoBooth onto the desktop. It is in .mov format so you can then add it to iMovie for further editing or just upload it to youTube as it is.
    Easy as pie!

  • How can I fetch the deliveries which are PGIed but not invoiced.

    Hi
    I want to search for the deliveries for which post goods issue has been done but are not invoiced.
    Kindly guide with you valuable comments.
    Regards,
    Satish.

    Hi,
    Use the T.Code:VF04.
    Goto T.Code:VF04
    Enter the Sold-to-party.
    Select Delivery related tick mark and uncheck all.
    Execute.
    It will give all the deliveries which are PGIed but not invoice.
    Regards,
    Krishna.

Maybe you are looking for

  • Unable to Save in Port Range Forwarding

    I'm using the BEFW11S4 wireless router and am unable to save the new port range forwarding settings I have entered.  Everytime I click Save Settings, I receive a box which reads: "The server 192.168.1.1 at Linksys BEFW11S4 V4 requires a username and

  • Changing default color of the text in a popupkeylov item

    Hi I need to change the color of text that is dipalying in a popuplov item, default is : gray and I need it black! where can I do it ?

  • How can I get my iPhone & iPad2 to share 1 calendar

    Trying to get my calendar to match up on my iPhone & iPad2.  Does anyone know how to do this?

  • Command Line in a Web Bowser

    Does anyone know of (open source) software that would allow me to access my computer via command line through a web browser? I would like to be able to control some features of my iMac from remote locations PCs without an SSH clients.

  • IMac 27" Intel i7 Shuts Down Unexpectedly

    My 18-month old iMac has started shutting down unexpectedly, it will not restart normally, i have to remove & reconnect the power to the machine and then it will restart. However it will shut down again soon afterwards. It would appear that the longe