Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query question 1

Status
Not open for further replies.

takaoki

Programmer
Aug 28, 2008
39
ZA
Hi,

I have a question. Are these "equivalent" statements?

Note: table "h" is defined futher down in the query, which is not shown here. This is just a snippet of the code.
Code:
SELECT TOP 1 x.AsOfDate FROM myTable x WHERE x.AsOfDate < h.AsOfDate ORDER BY x.AsOfDate DESC

SELECT MAX(x.AsOfDate) FROM myTable x WHERE x.AsOfDate < h.AsOfDate
Thank you
 
Yes, those should return the same value.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

My Blog
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top