June 21, 2005 at 1:11 pm
I have a date field with couple of values. How to retreive the second highest date using a single SQL statement?
Thanks & Regards.
June 21, 2005 at 1:14 pm
Select max(CrDate) as SecondMax from dbo.SysObjects where CrDate not in (Select max(CrDate) from dbo.SysObjects)
June 21, 2005 at 1:22 pm
It Works.Thanx Remi..
June 21, 2005 at 1:26 pm
Top n from X rank (only one of so many ways)
/*
Ivica Masar
*/
USE pubs
DECLARE @var1 VARCHAR(12)
DECLARE @var2 VARCHAR(30)
SET ROWCOUNT 17
SELECT @var1 = au_id, @var2 = au_lname FROM authors ORDER BY au_lname, au_id
SET ROWCOUNT 0
SELECT TOP 3 * FROM authors
WHERE (au_id >= @var1 AND au_lname=@var2) OR ( au_lname>@var2)
ORDER BY au_lname, au_id
June 21, 2005 at 1:28 pm
or this....
select top 1 Crdate from table
where Crdate (select max(Crdate) from table)
order by Crdate DESC
**ASCII stupid question, get a stupid ANSI !!!**
June 21, 2005 at 1:36 pm
AS I said, one of so many .
How's that coin tossing coming Sushila??
June 21, 2005 at 1:40 pm
Did you not get the video I sent you ?!?! It's been over 5 days since I mailed it!
**ASCII stupid question, get a stupid ANSI !!!**
June 21, 2005 at 1:42 pm
Know the best part Remi - agrees with all laws of physics; no illegal moves and still makes me the winner! <;-)
**ASCII stupid question, get a stupid ANSI !!!**
June 21, 2005 at 1:42 pm
You don't even my adress... you could try to get your lies together before telling them .
June 21, 2005 at 1:43 pm
I'll have to see that video to be sure of that.
June 21, 2005 at 1:57 pm
Yes indeed - & just so I don't make your address public (I'm sure you don't want that) - let's just say that it went "across the border" to Canada to a certain house with a cat and a black belt!!!!!
**ASCII stupid question, get a stupid ANSI !!!**
June 21, 2005 at 1:58 pm
Wrong house, got 2 cats and a dog.
June 21, 2005 at 2:04 pm
Okay - just pick it up from the other place - will have them notify you!
(Sorry!)
**ASCII stupid question, get a stupid ANSI !!!**
June 21, 2005 at 2:08 pm
Ya, I'll hold my breath... (30 M peeps in here).
Viewing 14 posts - 1 through 14 (of 14 total)
You must be logged in to reply to this topic. Login to reply