Click here to Skip to main content
15,886,362 members
Articles / Programming Languages / SQL

JOIN Instead of Repeating a Subquery

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
6 Feb 2011CPOL 6.3K   2  
As an alternate, I would like to share the following query using the previous table definition using RANK:DECLARE @FirstTable table(FirstName varchar(20))DECLARE @SecondTable table (ID int, FirstName varchar(20), LastName varchar(20), FirstNameHashCode varchar(20), ...

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
2 Feb 2011AspDotNetDev 1 alternative  
Rather than use multiple subqueries to extract TOP 1 data, this shows you how to use a single TOP 1 JOIN.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions