I have a table with ID and date fields, I need to assign a new date to a variable, where ID is some number.
ID
date
So, if I have dates 2011-01-01 and 2011-02-02 where ID = 1 , I need to assign the variable 2011-02-02 .
2011-01-01
2011-02-02
ID = 1
DECLARE @MAXDATE DATETIME SELECT @MAXDATE = MAX(DateVal) FROM YourTable WHERE ID = @ID
SELECT @Variable = Date FROM YourTable WHERE ID = 1 ORDER BY Date
Alternativelly:
DECLARE @yourDate DATETIME SET @yourDate = (SELECT MAX(date) FROM yourTable WHERE ID = 1);
Source: https://habr.com/ru/post/904249/More articles:Can I programmatically play radio on Android? - androidChanging a home environment variable in eclipse - androidUIViewController viewDidAppear - because it was clicked or because a subview was displayed? - iphoneGetting DbUnit to work with a sleep transaction - javaExtJS 4: How do I configure the repository to load models for a specific set of identifiers? - extjshttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/904250/why-does-this-iframe-tag-causes-safari-on-x64-windows-to-crash&usg=ALkJrhgZHSENdLD0OOAtNSK3FJDk_GwJbQsetTimeOut gives 233 fps, whereas requestAnimationFrame gives 61 - javascriptHow to show over 200 rows in a TStringGrid using LiveBindings? - delphiSetting the owner of objects in the S3 bucket - ruby-on-rails-3The consumable product acts weirdly and makes repeated requests. What could be the reason? - objective-cAll Articles