Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 compare row values in table

Author  Topic 

tracmonali
Starting Member

16 Posts

Posted - 2012-05-14 : 17:28:27
hello,
with table col as follows,
col1 col2 col3
Name1 addr1 11/11/2005
Name2 addr2 12/2/2005
name3 addr3 2/15/2006
Name4 addr4 3/28/2006
Name5 addr5 6/6/2010
now if @myvar = 03/01/2006, it should ignore all values greater than @myvar (aka 3/28/2006 and 6/6/2010) but pick up max of the values lesser than @myvar (11/11/2005, 12/2/2005, 2/15/2006). so output after comparing should pick up 2/15/2006. thanks.

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-05-14 : 17:45:27
Dup of http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=174715

People who run this forum STRONGLY advise against posting the same question to more than one thread (to avoid fragmentation, lost efficiency, wasted efforts etc.)
Go to Top of Page
   

- Advertisement -