I have a database including a table called [Table] which lists all tables in that database. Now I want to write a SQL query using some JOINS, which gets a specific tablename from [Table] in a subquery to select from that table... I hope this is not too confusing.
So [Table] looks like this:
IdTable Tablename
1 Adress
2 Project
3 User
...
The query should look like this:
SELECT * FROM (SELECT Type FROM dbo.[Table] WHERE tablename = 12)
Would something like that be possible?
I know, that subqueries are possible, but I do not know how to do that in this case.
Thanks in advance.
Regards Lars