I have 36 Microsoft SQL Server VM's, each with a specific database ending in _Sec as the DB name. There are 2 tables in this database that I need to get data from in a single query:
tblConnGroups has 3 columns that I need to include in the results
tblConnGroups.ID tblConnGroups.GroupName tblConnGroups.Provisional
tblConnGroupsDet has essentially one column that is needed in the results.
tblConnGroups.ID is a key used in
tblConnGroupsDet.GroupID, however in
ID field has a one-to-many relationship to the
GroupID field in
The Connection Group Name only appears in the
tblConnGroups with its
ID, and other information, but the
GroupID will be in each row of the
tblConnGroupsDet with a member database name.
USE [Name_Sec]; GO SELECT ID,Groupname,Provisional from [tblConnGroups] ORDER BY ID ASC ID GroupName Provisional 514 Name_FY0910 0 844 Name_FY1011 0 1588 NameTest_FY1516 1 USE [Name_Sec]; GO SELECT GroupID,DBName FROM [tblConnGroupsDet] ORDER BY GroupID ASC GroupID DBNAME 514 Name_Base 514 Name_FY0910 514 Name_State0910 514 Name_portal 514 Name_FY1011
I tried a couple of different join queries to match the
tblConnGroupsDet.GroupID and haven't quite figured out how to get the information I want out of these two tables.
Basically I need a query that will give me these results where
GroupName will get repeated for each
DBName where the
I'm hopeful that this is clearer than mud, I don't do a whole lot of DB Admin work, we've been trying to find a DBA, and this is a hat I don't put on very often.