在WQL/SCCM中联接两个表 [英] Joining two tables in WQL/SCCM

查看:195
本文介绍了在WQL/SCCM中联接两个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得我在这里真的很愚蠢.

I think I'm being really stupid here.

我正在使用vbscript.我已连接到SCCM服务器

I'm using vbscript. I've connected to an SCCM server

Set locator = CreateObject("WbemScripting.SWbemLocator")
Set connection  = locator.ConnectServer("SERVERNAME", "Root\SMS\SITENAME")

然后我有一个WMI WQL查询:

I then have a WMI WQL query:

Set Collections = connection.ExecQuery("SELECT LastStatusTime,AdvertisementID,
  LastStateName,AdvertisementName 
  FROM SMS_ClientAdvertisementStatus 
  INNER JOIN SMS_Advertisement 
  ON SMS_Advertisement.AdvertisementID = SMS_ClientAdvertisementStatus.AdvertisementID 
  WHERE  LastStateName = 'Succeeded' 
  AND LastStatusTime > '2012-09-25'")

FOR each Collection in Collections 

        Collection.LastStatusTime 
        Collection.AdvertisementID

Next

我认为我对WQL的理解存在差距.我似乎可以在此查询中加入这两个WQL表",但是我只能从SMS_ClientAdvertisementStatus返回值.

I think there's a gap in my understanding of WQL. I seem to be able to join these two WQL "tables" in this query, but I can only return values from SMS_ClientAdvertisementStatus.

如果我尝试从SMS_Advertisement返回任何信息(我已加入的表),我只会收到错误消息.

If I try to return anything from SMS_Advertisement, the table I've joined, I just get an error.

您是否可以在WQL中加入表"-如果它们甚至是表?还是我必须有一个嵌套查询?还是有另一种从两个表返回数据的方法?

Can you join "tables" in WQL - if they even are tables? Or do I have to have a nested query? Or is there another way of returning data from two tables?

推荐答案

WQL不支持JOIN,但是您可以使用MOF定义包含多个类数据的WMI类.看到这里:

WQL doesn't support JOINs, but you can use MOF to define WMI classes that contain data from multiple classes. See here:

创建新实例来自旧地产

这篇关于在WQL/SCCM中联接两个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆