/build/static/layout/Breadcrumb_cap_w.png

Combining SQL reports

I have a computer/user report  that i want to combine with my software reports as additional columns to it.  How can I combine the three together?

 

Computer report:

 SELECT MACHINE.NAME AS SYSTEM_NAME,SYSTEM_DESCRIPTION,BIOS_SERIAL_NUMBER,CS_MODEL,USER_LOGGED,LAST_SYNC,OS_NAME FROM MACHINE    ORDER BY SYSTEM_NAME
 
 
Software report1:
select DISPLAY_NAME as 'Software Title',
DISPLAY_VERSION as 'Version',
MACHINE.USER_FULLNAME as 'USER',
MACHINE.NAME as 'Computer'
from (SOFTWARE, MACHINE_SOFTWARE_JT, MACHINE) 
where MACHINE.ID = MACHINE_SOFTWARE_JT.MACHINE_ID and MACHINE_SOFTWARE_JT.SOFTWARE_ID = SOFTWARE.ID 
and not IS_PATCH
and DISPLAY_NAME LIKE '%microsoft% %project%'
and DISPLAY_NAME NOT LIKE '%MUI%'
and DISPLAY_NAME NOT LIKE '%Server%'
order by DISPLAY_NAME
 
Software report2:
select DISPLAY_NAME as 'Software Title',
DISPLAY_VERSION as 'Version',
MACHINE.USER_FULLNAME as 'USER',
MACHINE.NAME as 'Computer'
from (SOFTWARE, MACHINE_SOFTWARE_JT, MACHINE) 
where MACHINE.ID = MACHINE_SOFTWARE_JT.MACHINE_ID and MACHINE_SOFTWARE_JT.SOFTWARE_ID = SOFTWARE.ID 
and not IS_PATCH
and DISPLAY_NAME LIKE '%microsoft office% %2010%'
and DISPLAY_NAME NOT LIKE '%primary%'
and DISPLAY_NAME NOT LIKE '%database%'
and DISPLAY_NAME NOT LIKE '%access%'
and DISPLAY_NAME NOT LIKE '%word%'
and DISPLAY_NAME NOT LIKE '%excel%'
and DISPLAY_NAME NOT LIKE '%outlook%'
and DISPLAY_NAME NOT LIKE '%infopath%'
and DISPLAY_NAME NOT LIKE '%groove%'
and DISPLAY_NAME NOT LIKE '%powerpoint%'
and DISPLAY_NAME NOT LIKE '%components%'
and DISPLAY_NAME NOT LIKE '%language%'
and DISPLAY_NAME NOT LIKE '%meeting%'
and DISPLAY_NAME NOT LIKE '%mui%'
and DISPLAY_NAME NOT LIKE '%onenote%'
and DISPLAY_NAME NOT LIKE '%project%'
and DISPLAY_NAME NOT LIKE '%proof%'
and DISPLAY_NAME NOT LIKE '%sharepoint%'
and DISPLAY_NAME NOT LIKE '%single%'
and DISPLAY_NAME NOT LIKE '%visio%'
order by DISPLAY_NAME

0 Comments   [ + ] Show comments

Answers (2)

Posted by: dugullett 10 years ago
Red Belt
0

It looks like you already have the MACHINE table joined in the query. You just need to add the fields you need to the SELECT portion of the query. 

select DISPLAY_NAME as 'Software Title',
DISPLAY_VERSION as 'Version',
MACHINE.USER_FULLNAME as 'USER',
MACHINE.NAME as 'Computer', MACHINE.SYSTEM_DESCRIPTION,
MACHINE.BIOS_SERIAL_NUMBER,MACHINE.CS_MODEL,MACHINE.USER_LOGGED,
MACHINE.LAST_SYNC,MACHINE.OS_NAME

 

If I could also suggest using RLIKE or taking the % off of the beginning of the Display Name. It's been my experience leaving it like that takes a long time to return results. In my case with 90,000+ records the query would be looking for anything with %access%, %word%, or %excel%. You can clean this up some by changing it to 'Microsoft Access%', 'Microsoft Word%, or 'Microsoft Excel%'. For me doing it this way works better.

Posted by: Papo28 10 years ago
Orange Belt
0

bump =/

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ