Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 resolved-join multiple select

Author  Topic 

cutepraba
Yak Posting Veteran

53 Posts

Posted - 2009-06-06 : 09:06:45
how to join these to snigle sql

select * from table where id="100"
select top 10 * from table where id="200"

____________
Praba

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-06-06 : 09:15:29
how do you want to join them ?

UNION the result set ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

cutepraba
Yak Posting Veteran

53 Posts

Posted - 2009-06-06 : 09:20:44
I want to merge the rows, all the rows from first sql and top 10 from second sql. That will be to adogrid.

Both sql from one single table

____________
Praba
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-06-06 : 09:21:24
use UNION ALL


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-06-07 : 03:35:02
if you're using sql 2005 you can use just this

select row_number() over (partition by id order by id) as seq,*
from table
where id in ("100","200")
and (seq <=10 or id="100")
Go to Top of Page
   

- Advertisement -