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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Sql query for displaying records

Author  Topic 

abhishek
Starting Member

3 Posts

Posted - 2007-08-09 : 06:31:09
Hi,

I would like to know how would i display following data.

exa:- (Note:- I wrote '---' so to display properly in to the forum

Table1
ComputerName--IpAddress
ABC1-----------10.1.2.3
ABC1-----------10.1.2.4
ABC1-----------10.1.2.5
ABC2-----------10.1.2.6
ABC2-----------10.1.2.7
ABC3-----------10.1.2.8
ABC3-----------10.1.2.9
ABC4-----------10.1.2.10

Table2

ComputerName--NetCard
ABC1-----------<card1>
ABC1-----------<card2>
ABC2-----------<card3>
ABC2-----------<card4>
ABC3-----------<card5>
ABC3-----------<card6>

Table3
ComputerName--Model
ABC1-----------DEll
ABC2-----------DEll
ABC3-----------DEll

Now i want output should be displayed like this

ComputerName--IpAddress--NetCard Model
ABC1-----------10.1.2.3---<card1>---DEll
----------------10.1.2.4---<card2>
----------------10.1.2.5

ABC2-----------10.1.2.6---<card3>---DEll
----------------10.1.2.7---<card4>

ABC3-----------10.1.2.8---<card5>---DEll
----------------10.1.2.9---<card6>

ABC4-----------10.1.2.10

Black filled should not displayed anything

Is it possible


--------------------
Thanks and regards
Abhishek Joshi
India- Bangalore

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2007-08-09 : 07:05:47
Display = front end application.
Otherwise (since nobody EVER listens, EVER) look up Cross Tab reports in BOL

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

abhishek
Starting Member

3 Posts

Posted - 2007-08-09 : 07:41:42
Sorry I didn't get you...

So mean to say what is frond end application....

front end appilcation is SMS server 2003

--------------------
Thanks and regards
Abhishek Joshi
India- Bangalore
Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2007-08-09 : 08:01:08
SELECT a.computername,a.IpAddress,b.netcard,c.model
FROM
Table1 a
LEFT JOIN
Table2 b
ON
a.computername = b.computername
LEFT JOIN
Table3 c
ON
a.computername = c.computername

Is this what you mean?

Jim
Go to Top of Page

abhishek
Starting Member

3 Posts

Posted - 2007-08-09 : 11:46:38
Thanks Jim for a idea.... i will work on it..

--------------------
Thanks and regards
Abhishek Joshi
India- Bangalore
Go to Top of Page
   

- Advertisement -