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 |
mqh7
Yak Posting Veteran
58 Posts |
Posted - 2012-08-13 : 13:08:48
|
This first section of SQL code works. When run it will list all the PC Names. I assume it also lists the last logged on user but it does not display that.SELECT DISTINCT v_GS_COMPUTER_SYSTEM.Name0 AS [PC NAME]FROM v_GS_COMPUTER_SYSTEM INNER JOIN v_GS_system_console_userON (v_GS_SYSTEM_CONSOLE_USER.ResourceID = v_GS_COMPUTER_SYSTEM.ResourceID)ORDER BY [PC NAME]-------------------------------------------------------------------The view called v_GS_SYSTEM_CONSOLE_USER has the record called LastConsoleUse0 yet when I try to add this to my output I get an error. //Invalid object name 'v_GS_system_console_user.LastConsoleUse0'.//How do I call this field and display it? Do I need 2 SELECT statements? // this code does not work// SELECT DISTINCT v_GS_COMPUTER_SYSTEM.Name0 AS [PC NAME]FROM v_GS_COMPUTER_SYSTEM INNER JOIN v_GS_system_console_user.LastConsoleUse0 AS [LastUser]ON (v_GS_SYSTEM_CONSOLE_USER.ResourceID = v_GS_COMPUTER_SYSTEM.ResourceID)ORDER BY [PC NAME] .. ?? [LastUser] I would like displayed here |
|
mqh7
Yak Posting Veteran
58 Posts |
Posted - 2012-08-13 : 13:35:09
|
Got itSELECT DISTINCT v_GS_COMPUTER_SYSTEM.Name0 AS [PC NAME], LastConsoleUse0 AS [Last Logged On User] |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
mqh7
Yak Posting Veteran
58 Posts |
Posted - 2012-08-13 : 14:44:09
|
Yes, I am. That is how I wrote the first section. Thanks for the link. |
|
|
|
|
|