September 30, 2014 at 5:46 am
0 down vote favorite
I have a Database dbMain where I keep record of Multiple Database
dbMain(database) - > tblMain(table)
ID , DatabaseName , TableName
1 , Db1 , tblMember
2, Db2, tblMember
3, Db3, tblMember
Now i want to run a query which will give the Admin detail
(tblmember table -> UserType columnName )
can someone suggest me how to write the above query which will take dbname + tablename from tblMain table and give me admin details
Thanks
September 30, 2014 at 6:09 am
I think you're going to have to give us a bit more to work with than that.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
September 30, 2014 at 6:21 am
You need to join the mentioned table "tblMain" with the details table (tblMember?). Use the column(s) that defines the relation between these tables in your join statement.
SELECT ...
FROM tblMain
INNER JOIN tblMember
ON tblMain.column_x = tblMember.column_y
You don't give us all the details we need (table definition, sample data, desired output), so I can't give you a more clear answer.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply