sql order by - SQL to group by two rows? -


i need sql query below table

id    name      type     priority 1    french     new       2 2    english    new       3 3    spanish    new       4 4    deutch     old       1 5    japanese   old       2 6    chinese    new       5 7    monotype   old       3 8    hindi      new       6 9    greek      old       4 

i tried order type , priority, output returned looks this:

id      name     type     priority 1    french     new       2 2    english    new       3 3    spanish    new       4 6    chinese    new       5 8    hindi      new       6 4    deutch     old       1 5    japanese   old       2 7    monotype   old       3 9    greek      old       4 

i need output like

id      name     type     priority 1      french    new      2 4      deutch    old      1 

can suggest sql query that?

select *  (select top 1 * table type = 'new' order priority asc) new union select *  (select top 1 * table type = 'old' order priority asc) old 

i thnk, should give you're looking for


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -