Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
doerrs1
Starting Member
5 Posts |
Posted - 2010-06-01 : 11:39:59
|
| First time poster, novice SQL person looking for specifics:Have 2 mostly unrelated tables in our CMDB (Configuration Management Data Base) that do have a common column (server name).The 1st table has the bulk of the data needed for selection.The 2nd table has multiple rows (1-4) that relate to each of the 1st table's rows.I would like to generate a query (or series of queries) that would result in the 1st table data and multiple 2nd table rows being contained in a single output record.Can someone help?thank you in advance for any advice,Steve |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-06-01 : 11:41:07
|
any examples? No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2010-06-01 : 11:41:24
|
| Can you post table structure, some sample data and expected output. |
 |
|
|
doerrs1
Starting Member
5 Posts |
Posted - 2010-06-01 : 14:35:05
|
quote: Originally posted by vijayisonly Can you post table structure, some sample data and expected output.
Please forgive me, I am not sure how to display my example, so I took a screen shot of the data. How can I get that to you. As you can see below, I copy & pasted the .txt file and it is not very readable. Please advise.thanks, SteveTable 1 Main Server Table):Server Name Agency Criticality Application IP Application Mask Application2 IP Application2 Mask Mgt IP Mgt Mask LOM IP LOM MaskServerA Treasury Urgent 10.42.95.101 255.255.248.0 10.42.95.101 255.255.248.0 10.43.95.101 255.255.255.0 null null ServerB Treasury High 10.42.95.111 255.255.248.0 10.42.95.111 255.255.248.0 10.43.95.111 255.255.255.0 null nullServerC Corrections Urgent 10.42.98.29 255.255.248.0 10.42.98.29 255.255.248.0 10.43.98.29 255.255.255.0 10.43.98.30 255.255.255.0Table 2 (Network Switch information):KeyID Building Switch Name Switch Port Cabinet Patch Port Server Name IP Address VLAN Speed Type12847 ABC Ranch1 06/08 AC AC-32 ServerA 10.42.95.101 818 1000 Full Copper13015 ABC Ranch2 06/08 AC AC-12 ServerA 10.42.95.101 818 1000 Full Copper08618 ABC Ranch2 06/45 AC AC-21 ServerA-mgt 10.43.95.101 819 100 Full Copper18474 DEF Ranch4 01/08 DB DB-02 ServerC 10.42.98.29 818 1000 Full Copper14201 DEF Ranch5 01/08 DB DB-12 ServerC 10.42.98.29 818 1000 Full Copper22861 DEF Ranch5 01/42 DB DB-18 ServerC-mgt 10.43.98.29 819 100 Full Copper02211 DEF Ranch5 01/43 DB DB-15 ServerC-lom 10.43.98.30 819 100 Full CopperDesired Result:Server Name Agency Criticality App IP App Switch Name App Switch Port App2 IP App2 Switch Name App2 Switch Port Mgt IP Mgt. Switch Name Mgt Switch Port LOM IP LOM Switch Name LOM Switch PortServerA Treasury Urgent 10.42.95.101 Ranch1 06/08 10.42.95.101 Ranch2 06/08 10.43.95.101 Ranch2 06/45 .ServerC Corrections Urgent 10.42.98.29 Ranch4 01/08 10.42.98.29 Ranch5 01/08 10.43.98.29 Ranch5 01/42 10.43.98.30 Ranch5 01/43.... |
 |
|
|
|
|
|