Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Correted sub query question

$
0
0
 

SELECT a.[Property],

(selecttop 1 [company_matchscore], [SAPProperty]    

From [ritz].[STGE_FLDACTN_SITE_MSCORE] b

Where b.[Property]= a.[Property] orderby [company_matchscore] desc)

from(selectdistinct [Property] from [ritz].[STGE_FLDACTN_SITE_MSCORE]) a

When I run this query, I get following error:

Msg 116, Level 16, State 1, Line 5

Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.

Reseanon this error is occuring is because I am specifying  top 1 [company_matchscore], [SAPProperty]

If I get rid of  [SAPProperty]

it is running fine; but I want to get  [SAPProperty] as well from inner query, any idea how?


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>