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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 runnin a query on top of other query

Author  Topic 

samwise
Starting Member

7 Posts

Posted - 2005-08-31 : 06:14:32
Hi,

how do i run a query using the results of another query ?

is there a way to INNER JOIN more than two tables ?

Thanks

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-08-31 : 06:21:26
Post table structures, some sample data and the result you want

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2005-08-31 : 08:01:42
Hi,
Are you looking for something like this.. .

Select Column1,Column2 From Table1 Inner Join
(Select Column1 From Table2) As Tbl1 On Tbl1.Column1 = Table1.Column1




Complicated things can be done by simple thinking
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2005-08-31 : 08:21:17
quote:
Originally posted by samwise

is there a way to INNER JOIN more than two tables ?




SELECT ColA, ColB
FROM MyTableX X
INNER JOIN MyTableY Y ON Y.Key1 = X.Key1
INNER JOIN MyTableZ Z ON Z.Key1 = Y.Key1
et cetera
Go to Top of Page

kapilarya
Yak Posting Veteran

86 Posts

Posted - 2005-09-04 : 10:04:00

Try this

how do i run a query using the results of another query ?

Select * from secondtable where col1 in (select col2 from firsttable)



Kapil Arya
Go to Top of Page
   

- Advertisement -