sql - How to get Top 1 with Sort from Join -


instead of doing this:

select  t1.*,  (select top 1 t2.name table2 t2 order t2.number) val1 table1 t1 

how done join instead?

select   t1.*,   top 1 t2.name  table1 t1 join table2 t2 order t2.number 

or possible?

select  top 1 * (select t1.*, t2.number num table1 t1  join table2 t2 on t1.commoncolumn=t2.commoncolumn ) t order t.num 

Comments

Popular posts from this blog

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -