Select top 1 a.* from table1 a, table2 b where a.idcolumn=b.idcolumn order by the relavant_columnthis is sample code to using top clause in sql