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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -