MSSQL 2008 Query use query result in new query
Posted on 2012-03-13
Hi. i try to figure this out what kind of syntax to use but cant get this to work.
I want. Search in a database after most freqent ID
then make a new query and search in diffrent database whit the result from the first search as a parameter... please have a look belowe.. I verry new in MSSQL so be nice:D
SELECT DB01.ID, Count(DB01.ID) AS Antal
where Timestamp BETWEEN '2010-01-13 04:22:53.390' AND '2012-02-13 05:22:53.390'
GROUP BY DB01.ID
order by Antal desc
Results I get..
Then I would like to use
the first result "09366"
and search in a nother db.
order by Timestamp asc