我是I.T.我的第一个合作社的合作学生。我还没有在课堂上学习SQL,但是我已经被要求用我的I.T.设置SQL报告。经理。我之前从未在SQL中写过任何内容。
我需要列出办公室中的所有设备及其用户,并列出每个设备上安装的一组特定软件。我设法谷歌大部分的答案,但现在我需要过滤掉重复。我正在使用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
非常感谢任何建议或解决方案。
答案 0 :(得分:0)
我将报告导出到excel,删除了重复项,然后将其保存为.pdf。大约花了10分钟,但比在2天内自学SQL更容易。