如何过滤掉重复项?

How to filter out the duplicates?

我是 I.T。我的第一个合作社的合作社学生。我还没有在 class 中学习 SQL,但我的 I.T 要求我用 SQL 建立一个报告。经理。我以前从未在 SQL 中写过任何东西。

我需要列出办公室中的所有设备、它们的用户,并列出每台设备上安装的一组特定软件。我设法 google 大部分答案,但现在我需要过滤掉重复项。我正在使用 SpiceWorks 制作这份报告。

我收到了重复的邮件,因为这些软件中的大多数都有多个版本号。这是我的代码:

SELECT devices.NAME
    ,devices.primary_owner_name
    ,software.NAME AS installed_applications
    ,software_installations.version
FROM devices
INNER JOIN software_installations ON (devices.id = software_installations.computer_id)
INNER JOIN software ON (software.id = software_installations.software_id)
WHERE (
        devices.device_type IN (
            'Server'
            ,'Desktop'
            ,'Laptop'
            )
        AND software.NAME = 'AutoCAD LT 2011 - English'
        OR software.NAME = 'AutoCAD LT 2012 - English'
        OR software.NAME = 'AutoCAD LT 2013 - English'
        OR software.NAME = 'AutoCAD LT 2014 - English'
        OR software.NAME = 'AutoCAD LT 2015 - English'
        OR software.NAME = 'AutoCAD LT 2016 - English'
        OR software.NAME = 'BillQuick'
        OR software.NAME LIKE '%AutoDESK DWG TrueView%'
        OR software.NAME LIKE '%AutoDesk BDS%'
        OR software.NAME LIKE '%BillQuick Agent%'
        OR software.NAME = 'Microsoft Office 2010 Project'
        OR software.NAME = 'Microsoft Office 2010 Professional Plus'
        OR software.NAME = 'Microsoft Project Standard'
        OR software.NAME LIKE '%Vehicle Tracking%'
        OR software.NAME LIKE '%Autodesk Vehicle Tracking 2015 on AutoCAD 2015%'
        OR software.NAME LIKE '%AutoTURN%'
        OR software.NAME = 'Microsoft Office 2000'
        OR software.NAME = 'Microsoft Office 2007'
        OR software.NAME = 'Microsoft Office 2007 Professional Hybrid'
        OR software.NAME = 'Microsoft Office 2007 Project Standard'
        OR software.NAME = 'Microsoft Office 2010 Professional'
        OR software.NAME = 'Microsoft Office 2010 Professional Plus'
        OR software.NAME = 'Microsoft Office 2010 Project'
        OR software.NAME = 'Microsoft Office 2010 Project Professional'
        OR software.NAME = 'Microsoft Office 2010 Project Standard'
        OR software.NAME = 'Microsoft Office 365 - en-us'
        OR software.NAME = 'Microsoft Office 365 ProPlus - en-us'
        OR software.NAME = 'Microsoft Office Home and Business 2013 - en-us'
        OR software.NAME = 'Microsoft Office Professional 2013 - en-us'
        OR software.NAME = 'Microsoft Project Professional'
        OR software.NAME = 'Microsoft Project Standard'
        OR software.NAME = 'Microsoft Project Standard 2013 - en-us'
        )
ORDER BY devices.NAME
    ,software.NAME

我得到的样本是这样的:

mcgi00080 Santosh Bhattarai BillQuick 14.0.18.1

mcgi00080 Santosh Bhattarai BillQuick 16.0.12.1

mcgi00080 Santosh Bhattarai BillQuick 16.0.16.0

mcgi00080 Santosh Bhattarai BillQuick 16.0.17.25

mcgi00080 Santosh Bhattarai BillQuick 16.0.15.6

mcgi00080 Santosh Bhattarai BillQuick 16.0.18.2

mcgi00088 Christine Chin BillQuick 14.0.16.4

mcgi00088 Christine Chin BillQuick 14.0.16.6

mcgi00088 Christine Chin BillQuick 14.0.17.20

mcgi00088 Christine Chin BillQuick 15.0.12.10

mcgi00088 Christine Chin BillQuick 14.0.18.1

mcgi00088 Christine Chin BillQuick 16.0.12.1

mcgi00088 Christine Chin BillQuick 16.0.16.9

mcgi00088 Christine Chin BillQuick 16.0.15.6

mcgi00088 Christine Chin BillQuick 16.0.17.25

mcgi00190 administrator AutoCAD LT 2011 - English 18.1.49.0

mcgi00190 administrator AutoCAD LT 2011 - English 2.1

mcgi00190 administrator AutoCAD LT 2011 - English 18.1.116.0

mcgi00198 administrator AutoCAD LT 2012 - English 18.2.51.0

mcgi00080 Santosh Bhattarai AutoCAD LT 2013 - English 19.0.55.0

mcgi00080 Santosh Bhattarai AutoCAD LT 2013 - English 19.0.204.0

怎样才能让报告只包含每个软件的最新版本,而不是针对每个人?因此,如果 Santosh 的最新版本是 16.0.18.2 但 Jeff 的最新版本是 16.0.20.0,那么它将仅向 Santosh 显示 BillQuick 16.0.18.2 的一个版本,而对于 Jeff 仅显示 BillQuick 的一个版本:16.0.20.0 像这样:

mcg-file Admin BillQuick 14.0.16.4

mcgi00080 Santosh Bhattarai BillQuick 16.0.18.2

mcgi00088 Christine Chin BillQuick 16.0.17.25

mcgi00089 Dawn Myles BillQuick 16.0.18.2

任何建议或解决方案将不胜感激。

我将报告导出到 excel,删除了重复项,然后将其另存为 .pdf。多花了大约 10 分钟,但这比尝试在 2 天内自学 SQL 更容易。