Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

PDQ Inventory Application Summery Report

I'd like to create a report that shows which version of which application is installed on which computer.
Here you can see what I'd like to have:
table

I think, I can get all the required data using this query:

SELECT 
    Computers.Name as "Computer Name",
    Applications.Name,
    Applications.Version
FROM Computers
JOIN Applications USING (ComputerId)
UNION SELECT 'Count (latest)', * FROM (
    SELECT 0, 0 FROM Computers
    -- count rows (like "%latest%")
)
UNION SELECT 'Count (old)', * FROM (
    SELECT 0, 0 FROM Computers
    -- count rows (like "%old%")
)

The result looks like this:

Computers.Name     -   Applications.Name    -    Applications.Version
    Count (latest) -         0              -          0
    Count (old)    -         0              -          0
    PC1            -       7-Zip            -        19.00
    PC1	           -       Notepad++        -        14.2
    PC2	           -       7-Zip            -        18.00
...

Now I just need to transform the data, unfortunately sqlite does not offer the pivot function, how can I manually "pivot" the data? I already read this post: https://community.pdq.com/posts/9397-inventory-number-environment-variable-doesnt-show?sort=oldest - the diffrence is that I don't know which column will be there, because I won't put all application names (> 100) in a case check.

I know that there might be some other problems, let's try to solve the first problem first.

Thanks in advance.

0

Comments

5 comments
Date Votes
  • PDQi has a built in report named Applications that does exactly this.

    0
  • No, the built in Applications report doesn't do exactly this. I'd like to group the rows by the computer name and create for each application one column.

    0
  • OK, I misunderstood. The built in report can group the computers and display the applications by row, not column.

    0
  • Ok, but I get a few pages (arround 200) if I do this, isn't there another way? I mean I just need to switch the columns and the rows, am I overseeing something?

    0
  • The only way I know how to do it is to import the raw data into Excel and create a pivot table there.

    0