|
-
Oct 17th, 2008, 11:13 AM
#1
Thread Starter
Member
Query a Query
In the query builder in visual studio 2008 (visual basic) can you use an already created query in a new query,i.e.
in a new query called query2, use table1 and query1.
If not in the query builder, which would be very helpful, is there another way in StoredProcedures or code?
Thanks!
-
Oct 17th, 2008, 11:31 AM
#2
Re: Query a Query
I've never used Query Builder so I have no clue about that. Subqueries in stored procedures or code are fairly common, however.
Code:
SELECT * FROM [dbo].[Users] WHERE UserID IN (SELECT UserID FROM [dbo].[BannedUsers])
Stored procedures will return a value or record set but as far as I know, you can't use them as a subquery. I tried before but couldn't get it to work.
SQL Functions, however, can be used in a Subquery just like my example above.
Hope that helps.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|