Click here to Skip to main content
15,898,689 members

Comments by Shadow373 (Top 5 by date)

Shadow373 25-Jan-12 2:03am View    
Man, I really know about DATEADD. Your shot miss the target. See my comment to message from Markus.
Btw, DATEADD don't help if there are some holes between dates like this:
01.01.2012
03.01.2012
04.01.2012
21.02.2012
etc.
Shadow373 25-Jan-12 1:58am View    
Hi, Amir. I don't think that my instructor wants to make me fail. He say that he take this test from real working database. And ha also say that it was a simple select with conditions.
Shadow373 25-Jan-12 1:53am View    
That's was a direct order. :(
Shadow373 25-Jan-12 1:50am View    
Marcus, I know how to make this query using subquery. It's simple:
SELECT T.f, (SELECT MIN(t1.f) FROM T t1 WHERE T.F < t1.f) AS MinF
FROM T
ORDER BY T.f ASC
-- Here are results:
f MinF
----------------------- -----------------------
2012-01-01 00:00:00.000 2012-01-02 00:00:00.000
2012-01-02 00:00:00.000 2012-01-03 00:00:00.000
2012-01-03 00:00:00.000 2012-01-04 00:00:00.000
2012-01-04 00:00:00.000 2012-01-05 00:00:00.000
2012-01-05 00:00:00.000 2012-01-06 00:00:00.000
2012-01-06 00:00:00.000 2012-01-07 00:00:00.000
2012-01-07 00:00:00.000 2012-01-08 00:00:00.000
2012-01-08 00:00:00.000 2012-01-09 00:00:00.000
2012-01-09 00:00:00.000 2012-01-10 00:00:00.000
2012-01-10 00:00:00.000 NULL

but i need remove this part
(SELECT MIN(t1.f) FROM T t1 WHERE T.F < t1.f) AS MinF
and make query without it.

I think about it but can't find solution. That's why I ask community help.
Shadow373 31-Dec-11 13:31pm View    
Thank you! Your explanation really help me not only with comboboxes.