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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 2008 srv SQL query

Author  Topic 

j0n0
Starting Member

2 Posts

Posted - 2011-12-09 : 18:55:18
Hi,

Could somebody please help me.

I run the following which works except I want to display the actual name of the computer which is in another table.

select computer_id,value,version from computer_lists where value='iTunes'and version='10.5.1.42'

The other table is called computer and the field is called computer_name

TIA

jono

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-12-09 : 19:04:48
Are the two tables linked together by computer_id? If so:

select cl.computer_id, c.computer_name, cl.value, cl.version
from computer_lists cl
join computer c
on cl.computer_id = c.computer_id
where cl.value='iTunes'and cl.version='10.5.1.42'

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-12-09 : 19:06:28
[code]
select l.computer_id, l.value, l.version , c.computer_name
from computer_lists l
inner join computer c on l.computer_id = c.computer_id
where l.value = 'iTunes'
and l.version = '10.5.1.42'
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

j0n0
Starting Member

2 Posts

Posted - 2011-12-10 : 13:39:39
Thank you to all! - job done
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-12-10 : 15:50:53


Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -