-1

現在、sccm 2012 データベースの SQL クエリを作成しており、すべてのクライアントからインストールされているプログラムを調べたいと考えています。

しかし、リクエストの後、すべてのクライアントは同じプログラムを持っています。

コードは次のとおりです。

SELECT Computer_System_DATA.Name00,
       Computer_System_DATA.UserName00,
       installed_software_data.productname00,
       installed_software_data.publisher00
FROM Computer_System_DATA, installed_software_data
WHERE installed_software_data.publisher00 NOT LIKE N'%microsoft%' and 
      installed_software_data.publisher00 NOT LIKE N'%Intel%' and  
      installed_software_data.publisher00 NOT LIKE N'%nvidia%' and 
      installed_software_data.publisher00 NOT LIKE N'%vmware%'and 
      installed_software_data.publisher00 NOT LIKE N'%symantec%'and 
      installed_software_data.publisher00 NOT LIKE N'%hewlett-packard%'and
      installed_software_data.publisher00 NOT LIKE N'%hp%'and
      installed_software_data.productname00 NOT LIKE N'%driver%' and 
      installed_software_data.productname00 NOT LIKE N'%install%' and 
      installed_software_data.productname00 NOT LIKE N'%update%' and 
      installed_software_data.productname00 NOT LIKE N'%treiber%' and 
      installed_software_data.productname00 NOT LIKE N'%microsoft%' and 
      installed_software_data.productname00 NOT LIKE N'%hp%' and 
      installed_software_data.productname00 NOT LIKE N'%ghost%' and 
      installed_software_data.productname00 NOT LIKE N'%flash%'and 
      installed_software_data.productname00 NOT LIKE N'%hotfix%' and 
      installed_software_data.productname00 NOT LIKE N'%patch%' and 
      installed_software_data.productname00 NOT LIKE N'%device%' and 
      installed_software_data.productname00 NOT LIKE N'%runtime%' and 
      installed_software_data.productname00 NOT LIKE N'%java%' and 
      installed_software_data.productname00 NOT LIKE N'%player%' and 
      installed_software_data.productname00 NOT LIKE N'%ati%' and 
      installed_software_data.productname00 NOT LIKE N'%broadcom%'and 
      installed_software_data.productname00 NOT LIKE N'%canon%' and 
      installed_software_data.productname00 NOT LIKE N'%dell%' and 
      installed_software_data.productname00 NOT LIKE N'%divx%' and 
      installed_software_data.productname00 NOT LIKE N'%epson%' and 
      installed_software_data.productname00 NOT LIKE N'%veritas%' and 
      installed_software_data.productname00 NOT LIKE N'%defender%' and 
      installed_software_data.productname00 NOT LIKE N'%AFPL%' and 
      installed_software_data.productname00 NOT LIKE N'%web%' and 
      installed_software_data.productname00 NOT LIKE N'%xml%' and 
      installed_software_data.productname00 NOT LIKE N'%framework%' and 
      installed_software_data.productname00 NOT LIKE N'%soundmax%' and 
      installed_software_data.productname00 NOT LIKE N'%silverlight%' and 
      installed_software_data.productname00 NOT LIKE N'%buffer%' and 
      installed_software_data.productname00 NOT LIKE N'%Crazyflie Client%'
4

2 に答える 2

2

FROM 句でクロス結合を行っています。ここでは、おそらく適切な ON 句を含む INNER JOIN が必要です。何かのようなもの:

FROM   Computer_System_Data INNER JOIN
       Installed_SoftWare_Data 
         ON Computer_System_Data.ComputerID = Installed_SoftWare_Data.ComputerID
于 2013-05-17T10:39:38.967 に答える
1

これを試してみてください -

 SELECT  c.Name00 ,
            c.UserName00 ,
            d.productname00 ,
            d.publisher00
    FROM dbo.Computer_System_DATA c
    CROSS JOIN dbo.installed_software_data d --ON c.ComputerID = d.ComputerID
    WHERE NOT EXISTS (
            SELECT 1
            FROM (
                VALUES 
                (N'microsoft'),(N'Intel'),
                (N'Intel'),(N'nvidia'),
                (N'vmware'),(N'symantec'),
                (N'hewlett-packard'),(N'hp')
            ) AS x(filter)
            WHERE d.publisher00 LIKE N'%' + filter + N'%'
        )
    AND NOT EXISTS (
            SELECT 1
            FROM (
                VALUES 
                    (N'driver'),(N'install'),
                    (N'update'),(N'treiber'),
                    (N'microsoft'),(N'hp'),
                    (N'ghost'),(N'flash'),
                    (N'hotfix'),(N'patch'),
                    (N'device'),(N'runtime'),
                    (N'java'),(N'player'),
                    (N'ati'),(N'broadcom'),
                    (N'canon'),(N'dell'),
                    (N'divx'),(N'epson'),
                    (N'veritas'),(N'defender'),
                    (N'AFPL'),(N'web'),
                    (N'xml'),(N'framework'),
                    (N'soundmax'),(N'silverlight'),
                    (N'buffer'),(N'Crazyflie Client')
            ) AS x(filter)
            WHERE d.productname00 LIKE N'%' + filter + N'%'
        )
于 2013-05-17T10:45:43.930 に答える