SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 compare row values in table
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

tracmonali
Starting Member

16 Posts

Posted - 05/14/2012 :  17:28:27  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

5152 Posts

Posted - 05/14/2012 :  17:45:27  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000