Hi,

I'm trying to create a report of printers installed on all computers. I've gone through the report wizard and select other.printers. My problem is that it seems to jumble the output (puts multiple printers on the same line)

Here's my sql query

SELECT MACHINE.USER_NAME AS MACHINE_USER_NAME, PRINTERS FROM MACHINE ORDER BY MACHINE.USER_NAME asc

Thanks
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

0
The printers are all stored in one text field separated by carriage returns. To get a report of one line per printer you would have to make a list of your printers somewhere and join that to machine. Here's an example:

SELECT ID, PRINTERS, P1 FROM MACHINE M LEFT JOIN (select 'Microsoft XPS Document Writer' P1 UNION ALL select 'Adobe PDF' P1) PRINTER
ON FIND_IN_SET(P1,REPLACE(PRINTERS,'\n',','))>0
WHERE P1 IS NOT NULL
ORDER BY 1,3
Answered 06/20/2011 by: GillySpy
Seventh Degree Black Belt

Please log in to comment
Answer this question or Comment on this question for clarity