Recent Date, Last date and Date before that

What is the way to reterieve the latest date, Last date before that .....I need to use this for version maintenance table.
I need to do this withouth doing max...below  is my query
declare
@version varchar(10)
=
'@VERSION'
--declare @version varchar(10)= 'Daily Planet'
update
dbo.Version_Control
set [VERSION TYPE]='Previous'
where
datediff(d,[SUBMISSION
DATE],(getdate()))
= 1
update
dbo.Version_Control
set [VERSION TYPE]='Archive'
where
datediff(d,[SUBMISSION
DATE],getdate())>
1
if
exists(select
[VERSION TYPE] from
version
where [SUBMISSION DATE]=convert(char(10),getdate(),101)
and dbo.Version_Control=@version
and [type]='Current')
and
not
exists(select
[VERSION TYPE] from
version
where [SUBMISSION DATE]=convert(char(10),(getdate()),101)
and dbo.Version_Control=@version
and [VERSION TYPE]='Final')
update dbo.Version_Control
set [VERSION TYPE]='Current'
where
datediff(d,[SUBMISSION
DATE],getdate())=0
else
update dbo.Version_Control
set [VERSION TYPE]='Archive'
where
datediff(d,[SUBMISSION
DATE],(getdate()))=
0
SPPandey

I have :
Version                                   Version Type                   Submission
Date                 IMPORT
FA14 f1 EQ                               Final                             
3-25-2014                               DP
Recon 4-2014                          Final                              
2-11-2014                               Recon
FA14 F2 EQ                              Previous                       
2-25-2014                               DP
FA14F3 EQ                              Archive                           1-17-2014                              
DP
FA14 F1 EQ Current                Current                          3-25-2014                              
DP
FA14 F2 EQ Current                Archive                         
3-9-2014                                  DP
This is my desired outcome which state that depending on what version I am importing I need to sort the file/data as Final,Previous and Archive. The way I can do it is my looking at the submission date. The latest would be my Final, then previous and archive.
If there is a current then that would be current for the latest date. If there is a current from previous date than everything would be archive.
SPPandey

Similar Messages

  • I recently purchased an iMac and found out that I can download OSX LIon for free, but have been unable to redeem on the Canada site.  According to their info Canadian systems should be eligible.  How do I redeem this on the Canadian site

    I recently purchased an iMac and found out that I can download OSX LIon for free, but have been unable to redeem on the Canadian site.  According to their info Canadian systems should be eligible.  How do I redeem this on the Canadian site?

    Please read and follow the instructions at the Lion - Get up to date site. If you continue to have problems you can contact AppleCare (the number is in your owners manual or you can use the AppleCare Contact Info site. 

  • I recently upgraded to Lion and i find that my computer is running slow and applications are crashing.  For example I have Word 2011 for Mac and it crashes all the time I end up losing my work.  It often happens when I'm in notebook trying to record.

    i recently upgraded to Lion and i find that my computer is running slow and applications are crashing.  For example I have Word 2011 for Mac and it crashes all the time I end up losing my work.  It often happens when I'm in class using notebook and when I press record my computer starts thinking and it freezes.
    Also, I feel that it overheats often and my battery runs out pretty quickly.  I had the macbook (black) and this never happened before.  I'm not sure if I'm doing something wrong or if there is something with my computer.I bought my computer summer 2010, I don't think this should be happening. Please Help......

    This is exactly what keeps happening to mine too.  I was at a conference taking notes, and I was
    using the Notebook template, and doing some audio recording simultaneously.  About 3 hours into the conference (not consistently recording, but on and off with the sessions) my file wouldn't save anymore, saying something like "File cannot be modified while in use with another program" and "Invalid file name" when I would go back into my folder to look for it). I tried installing some updates from Microsoft, and when I restarted, I was at least able to open my old notes again, and so far it looks like the audio was working.  However, today at the conference, the same thing happened again, but I wasn't actively recording any audio (though after I had copy and pasted my second file of notes into the original, I went back to using it after re-naming it). 
    Does the crash happen to you under similar cirucumstances?  The update might help a little, but it is definitely not the solution.  Does anyone have any solutions?  Lion shouldn't be this buggy... I moved to Mac to get away from the garbage of bugs and compatibility issues...

  • I recently restarted my iphone and now all that appears is the apple logo how do i fix this problem

    i recently restarted my iphone and now all that appears is the apple logo how do i fix this problem?????

    Plug it into your computer and restore it.

  • I've had 3 s4 minis in the last 3-4 weeks and 1 before that....

    I have gotten 3 galaxy s4 minis in about 4 weeks, not to mention the original one, which makes it 4 phones that I have had in the last 8 months or so. Most, not all, but most of the stuff that has been going wrong happened AFTER the kit kat update.
    They all have the same problems, I have soft booted, hard booted, safe moded, factory reset and even gone to best buy and had 2 of them flashed.
    I have had a discussion on line with Samsung, I have called too many times to figure out, and gone into-again to many times to figure out--Verizon stores.
    I have reformatted my sd card. I have gotten a new sd card. with the second to last phone I got a new sim card.
    It's ridiculous. Samsung said there was something the matter with my phone and wanted me to send it back; that would have taken 2 weeks for me to get it back. That wasn't going to happen. So verizon sent me a new phone which is the one I just activated Sunday, September 7, 2014. The next day it acted up and it had a new sd card and I had uninstalled all the apps I had on there, which wasn't more than 5.
    I can pull up the email I wrote about everything that keeps happening with these phones if you'd like.
    I have read so many forums here, Android Central. etc.
    I have come across others who have have done all that I have. Before I got the last 3, I factory reset that phone 3 times.
    This is just stupid! The common denominator now is Verizon.
    I went into a store today and talked with them about this and they at my phone and said it was software and hardware related and had nothing to to with Verizon.
    BUT....no one seems to have heard of problems with the s4 mini. SO....what's up with mine?
    After 4 phones, I know I am not crazy.
    I want out of my contract. Verizon has not help up it's end of the contract and provided me with a phone that works. I have spent more time trying to figure out and get fixed what is wrong with my phones.
    It's been a waste of my time and energy. I am supposed to be able to put apps and pictures and music and many many things on this phone and I'm just tired of setting it how I want it because I keep having to re do it.
    I like the smallness of this phone but it doesn't work. Too much time, energy, and money in this.
    I want Verizon to cancel my contract because they haven't held up their end of the bargain.
    I'm not the only one with lots of problems with these phones; read the forums and you will find many people.
    Since there isn't a way to email Verizon for help, and when I call in, I have to go through telling the rep whats going on, troubling shooting with him/her, than being sent to tech support and having to go through the whole thing again,
    It looks like I have to actually send a letter through the United States Postal Service!
    Wow, what tech giant Verizon is that I have to reach them by mail.
    I'm not happy. I want a phone that works and a company that will take the time to see what's wrong or look up what's wrong, and/or suggest and help me with something because I'm not doing this insanity anymore. Most of the time the reps and techs have been supportive and/or helpful BUT...I still have a phone that doesn't work and no one has been able to tell me why or even tell me that others are having this problem. I get told something different by most everyone I've talked to.
    So after 4 phones, now what?????

    Hi Suzy Q,
    I can send and receive calls.
    I get "messaging stopped" when doing a lot of texts.
    Texts come up "ghosted" meaning they have the text on the bottom and a transparent one overlaid  on top. they then become one. But I get the ghosting most of the time when I go into a message from a contact to send a text.
    When I go to call logs or text logs, the numbers come up first, and then then the names pop up randomly, meaning not in order down the page, until they are all shown. lots of lag time.
    It runs slow.
    I have 5 apps on here. I should be able to have a  lot of apps on here, and play music, and have files, and...and....and.
    I can get online but doing a Google search, when the page with the choices comes up, it is blurred and I have to tap on the screen for it to become clear and readable.
    When online and scrolling, it hitches sometimes/lags/gets stuck then unstuck
    I get VZWAVS has stopped. (not sure if those are the right letters)
    The status bar that is supposed to be gray with the new update, goes back and forth between green--the old os--to gray. And I have found no continuity with when I get green or when I get gray.
    I get a black screen on occasion.
    sometimes the proximity sensor doesn't work.
    sometimes when I have my bluetooth on and have "hands free mode" on, I get the a text message read through the headset and also through the handset.
    I soft reboot often--turn it off wait a bit and

  • Suddenly my calendar events are deleted from 2 months ago and all before that.  I like to keep that information.  How is that done?

    How can I stop my I pad calendar from deleting events in the past, like all of them from 2 months ago and earlier?
    Thanks.

    When you connect your iPad to your computer, open iTunes, click on the name of your ipad and then on the info tab. In there you'll see the options for the calendar, one of which is how far back to keep info. Set it as far back as you want. Just know that calendar data is part of what makes up the 'other' part of your memory consumption. So more data like that you keep, less room you will have for other stuff.

  • HT1766 I lost all of my contact information when I back up it into ITUNES last night and I see that Itunes completed a back up. I tried to restore it but the phone would not respond. So I started as new and it store me back when I purchased the phone 2 ye

    Last night I back up my phone to my computer as always and once it completed it was not responding. I tried to restore the infromation as of the back up last night but it ask for a password which I do not remember placing. I was able to store as of the date I purchased the phone 2 years ago. Also, I am not in the cloud.
    How do I get this password so I can get my information back???
    Thank you

    Unfortunately you've discovered too late how important it is to maintain an up-to-date backup of your iTunes library (and all other data of value).  You could, before wiping the drive, have considered making use of a commercial data recovery service that could (albeit at considerable cost) have extracted your library from the hard disk, even if virus infected.
    In the absence of that option, you will need to restore the content of your library from its original sources:
    Depending on your location, you may be able to re-download any iTunes Store purchases that are still available on the Store
    Likewise, most digital purchases from Amazon (including auto-rip copies of purchased CDs) should be available from the Amazon Cloud and via the Amazon Music application - the same may be true of other commercial sources for digital downloads
    Content imported from your CDs will have to imported again
    The specific situation that you describe regarding the music imported from your friend's external HDD suggests that either the source is badly organized and/or originates from a source other than iTunes (other media players may use alternative tags for information like artist, title, album, etc. that are not wholly consistent with how iTunes handle these).  Without details of the issues you're seeing it is difficult to suggest a remedy other than going through the media album-by-album, track-by-track, and correcting the inconsistencies.
    In the absence of a backup or access to the original library data there is no option other than painstakingly recreating your library as described above.  As you do so, you'll now realize how important creating and maintaining backups are - in my case I have at all times three separate duplicates of my library, in two different locations, where none is ever more than a week old compared to the content of my master library.

  • I recently uninstalled my itunes and reinstalled. after that i lost all my music and am unable to put hunderds of songs back onto my itunes and ipod. help!

    I uninstalled my iTines and re-installed on my Fujitsu laptop.When I went to synch, I was unable tosynch my iPod to my iTunes. In addtion,I am unable to put my iTunes library of 100s of songs back onto my iTunes or iPod.I have lost all my compilations and my playlists.

    Hey bryce255,
    Thanks for the question, that definitely sounds frustrating. Luckily, we have steps available that may be able to restore your previous library:
    No content shows up in iTunes after updating
    http://support.apple.com/kb/TS1967
    Resolution
    1. Quit iTunes.
    2. Download and install the latest version of iTunes.
    3. Use the Finder (Mac) or Windows Explorer (Windows) to go to the iTunes folder that contains the iTunes library files:
    Mac OS X
    /Users/username/Music/iTunes/
    Microsoft Windows Windows XP and Windows 2000
    \Documents and Settings\username\My Documents\My Music\iTunes\
    Microsoft Windows Windows Vista and Windows 7
    \Users\username\Music\iTunes\
    4. Drag the iTunes Library file from the above location to the Desktop.
    5. Open the Previous iTunes Libraries folder in the iTunes folder.
    6. Locate the file named iTunes Library YYYY-MM-DD where YYYY-MM-DD is the date you upgraded iTunes (Year-Month-Day).
    7. Drag this file to the iTunes folder (the enclosing folder).
    8. Rename this file to iTunes Library.
    9. Open iTunes.
    You should now see your missing content in iTunes.
    If the above does not resolve your issue, you can learn about re-creating your iTunes library:
    iTunes: How to re-create your iTunes library and playlists
    http://support.apple.com/kb/HT1451
    Thanks,
    Matt M.

  • I have just bought Ipad3 last week and now know that its spec. got updated. Is there any chance i can have free upgrade with mine to the A6 one?

    As stated in the title! Please help!

    @imwater,
    Here's what I just read on 9to5Mac:
    "For those who purchased the third-generation iPad recently... CNET reported that local Apple Stores might replace the third-generation iPad with the new fourth-generation if it was purchased within the last 30 days."
    Since you qualify for this 30-day policy, I think you have a pretty good shot at getting that upgrade.
    Here's the full story: http://9to5mac.com/2012/10/23/apple-will-exchange-3rd-gen-ipads-purchased-within -the-past-30-days-for-a-shiny-new-4th-gen/
    Hope this helps!

  • I just bought an iMac last week and was told that I could update to Mountain Lion for free. How do I do this?

    Am I eligible for a free upgrade to Mountain Lion? I just bought my iMac last week.

    http://www.apple.com/osx/uptodate/

  • HT204088 Ruth, I purchased wps wizard August 2013. It was not what we needed. Representative guided me to pages last night and we purchased that. I need a refund for wps wizarg. Thank you

    Ruth, I purchased wps wizard August 27, 2013. It was not what we needed. We need a fefund. Joetta
    <Personal Information Edited by Host>

    Most of the people on these public forums, including myself, are fellow users - you're not talking to iTunes Support here. I've asked the hosts to remove your email address and phone number from your post's title.
    I don'tknow who Ruth is, but you can try contacting iTunes Support and see if they will refund or credit you : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • I had something that help me find the last pages and recentpages I visited but I had to reinstall fox fire and it's gone how do i get it back and what was it call

    I open a new tab and recent pages, last pages and most visited pages, would be displayed but I had to uninstall fox fire then reinstall and now it gone. How do I get that back? What was it call.

    You have probably simply opened a blank Layout template which has no default text area. In Layout documents you need to add textboxes to the page.
    Just start over from the Tempalet Chooser and pick a Word Processing document (see the sidebar titles) or a template with actual content in it already.
    Peter

  • Syncing apps and deleting apps that aren't on home screen

    My first question is about syncing apps. Should apps that I install directly on the iPhone from the App Store (not through iTunes) not show up in my synced apps list? At first syncing apps gave an error (I forget what it was) now the last time (or time before) that I synced it asked me to register the computer for syncing apps (or something like that) so I did. There are only a few apps showing in my apps section in iTunes (ones I tried downloading and syncing to my iPhone but unsuccessfully so I used the App Store on my iPhone to install them). At least I was smart enough to test it with free apps. So, I'm wondering if my apps don't show on the apps page (in iTunes) and I delete from my iPhone, that would mean that I wouldn't be able to reinstall without redownloading (and possibly paying again if it's a paid app), right? Is there a way to get my iTunes to sync my apps properly? Maybe its a Windows 7 problem?
    Next question ...
    I've downloaded more apps than fit on my homescreen but now would like to delete at least one of those. Is there a way to do this? This may relate to my previous question in that it seems to not be working to sync my apps so I can't use iTunes to control them. I will need to do it from my iPhone.
    Another quesion relating to my first ...
    If my apps are not synced properly and my iPhone crashes will I lose all my apps or are they backed up when the iPhone is backed up and can be restored from the backup?

    They should. You can use File menu > Transfer Purchased From to move them, if needed.
    Extra 'screens' show up in iTunes, on the Applications tab, if your software is the latest version. You can manage the apps there.
    App data is backed up and can be restored. The apps themselves are synced, but not backed up. However, you can redownload apps for free:
    http://support.apple.com/kb/HT2519

  • I dropped my iphone 3G last day and soon after the display became very dim and it still remanins the same..Could anyone pls help with a solution? Should I change the display or is it a minor damage?

    I dropped my iPhone 3G last day and soon after that the display turned too dim and it still remains the same.
    Could anyone help me with a solution?
    Should I change the display or is it a minor damage??
    Thanks for your support

    sounds like you broke the display when you dropped it.  There's nothing we users here can do for you.
    Since the iPhone warranty does not cover accidental damage, you will have to pay to have your phone repaired or replaced.  You can bring it into Apple for an out of warranty exchange in the country of purchase, or you can find a 3rd party iPhone repair store in your area.

  • TS3579 I found this useful because I did not know about the effect of typing in data and that you could only drag to rearrange the data.  I had typed in data before and this had caused problems but restoring defaults did not cause correct dates to show up

    I found this  (TS3579: If the wrong date or time is displayed in some apps on your Mac Learn about If the wrong date or time is displayed in some apps on your Mac) useful because I did not know about the effect of typing in data and that you could only drag to rearrange the data.  I had typed in data before and this had caused problems but restoring defaults did not cause correct dates to show up in Finder. 

    It sounds like there are a couple things going on here.  First check if you have a successful install of SQL Server, then we'll figure out the connection issues.
    Can you launch SQL Server Configuration Manager and check for SQL Server (MSSQLSERVER) if default instance or SQL Server (other name) if you've configured your instance as a named instance.  Once you find this, make sure the service is started. 
    If not started, try to start it and see if it throws an error.  If you get an error, post the error message your hitting.  If the service starts, you can then launch SSMS and try to connect.  If you have a default instance, you can use the machine
    name in the connection dialog.  Ex:  "COWBOYS" where Cowboys is the machine name.  However, if you named the SQL Server instance during install, you'll need to connect using the machine\instance format.  Ex:  COWBOYS\Romo (where Romo
    is the instance name you set during install).
    You can also look at the summary.txt file in the SQL Server setup error logs to see what happened on the most recent install.  Past install history is archived in the log folder if you need to dig those up to help troubleshoot, but the most
    recent one may help get to the bottom of it if there is an issue with setup detecting a prior instance that needs to be repaired.
    Thanks,
    Sam Lester (MSFT)
    http://blogs.msdn.com/b/samlester
    This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click
    "Mark as Answer" and
    "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread.

Maybe you are looking for

  • How to get LastModified time of a file in repository(in weblogic8 and Compa

    hi , my task is that i have to compare modified time of 2 file.one is in file system other is database file . which is most recently updated (which is newer). details : we have to check that which file is most recently updated .if database 's file is

  • FOIs not appearing in MapViewer with Internet Explorer

    I am using MapViewer 10133p5 and having some trouble placing FOIs in Internet Explorer (that is to say, the code that seems to be working fine in Firefox fails in IE). I have reduced my HTML to what I think are the bare essentials and pasted its cont

  • GPIB write error code 6, how to do proper wait in GPIB comm

    Hi! I use a Keithley MUX and a DVM to measure different values in my system, including 4 wire resistance. My project runs for several hours without any problem, but last night I have got an error after approx. 8 hours runtime. My error out in the mai

  • Audigy 2 ZS Plat everything works except audio cd playb

    After installing the card, I have lost the ability to play audio cds. I have system sound, all audio file types play from HD, both dri'ves read and burn data. All other bundled software functions properly. When I insert an audio cd, all tracks show i

  • Import/Export mailbox - what is included by default?

    Hello! I think this is unclear in the documentation: Will a new export request export the complete mailbox by default? Included contacts, calendar, online archive? New-MailboxExportRequest -Mailbox Username -FilePath \\savelocation\username.pst Kthxb