‎04-17-2012 06:56 PM
SELECT TOP 1000000 tsysdevicetypes.itemtypeicon10 AS icon,
tblcustdevices.displayname AS [Device name],
tblcustdevices.model,
tblcustdevices.vendor,
tblcustdevices.location,
tblcustdevices.devicekey,
tblcustdevices.purchasedate,
tblcustdevices.serialnumber,
tblcustdevices.contact
FROM tblcustdevices
INNER JOIN tsysdevicetypes
ON tsysdevicetypes.itemtype = tblcustdevices.devicetype
WHERE tblcustdevices.location = 'Room 150'
ORDER BY tblcustdevices.displayname
SELECT TOP 1000000 tblcomputers.computername,
tblcomputers.computerunique,
tblcomputers.domain,
tblcompcustom.purchasedate,
tblcompcustom.warrantydate,
tblcompcustom.location,
tblcompcustom.building,
tblcompcustom.department,
tblcompcustom.branchoffice,
tblcompcustom.state,
tblcompcustom.lastchanged,
tblcompcustom.barcode,
tblcompcustom.custom1,
tblcompcustom.lastsaved,
tblcompcustom.firstseen,
tblcompcustom.lastseen
FROM tblcomputers
INNER JOIN tblcompcustom
ON tblcomputers.computername = tblcompcustom.computername
WHERE tblcompcustom.location LIKE 'Room 150'
ORDER BY tblcomputers.computerunique
Solved! Go to Solution.
‎04-17-2012 10:47 PM
‎02-14-2013 05:24 PM
‎02-13-2013 05:57 PM
Select 'DEV' as [Type], '' as [Computer Name], tblcustdevices.displayname as [Device Name], '' as [Domain], tblcustdevices.vendor as [Vendor]
FROM tblcustdevices
WHERE tblcustdevices.location LIKE 'Room 150'
UNION
Select 'COMP' as [Type], tblcomputers.computerunique as [Computer Name], '' as [Device Name], tblcomputers.domain as [Domain], '' as [Vendor]
FROM tblcompcustom
INNER JOIN tblcomputers
ON tblcomputers.computername = tblcompcustom.computername
WHERE tblcompcustom.location LIKE 'Room 150'
‎02-14-2013 12:21 PM
harringg wrote:
This report worked in V4. Could you assist with similar code for v5?
Select Top 1000000 tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
tblAssets.IPAddress,
tblAssetCustom.Custom9,
tblAssets.Lastseen
From tblAssets
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Left Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Order By tblAssets.IPNumeric
‎04-18-2012 08:32 PM
‎04-18-2012 08:36 PM
wcb wrote:
I played around with it on my site and it seems it does not like column names with spaces. I removed the spaces in Computer Name and Device Name on my example and it now works in the browser.
‎04-18-2012 08:05 PM
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
‎04-18-2012 07:52 PM
Notice the data from tblcomputers.domain and tblcustdevices.vendor are unique values, but are under the same column. I'd like them each in their own column. So for a given row, tblcomputers.domain would be "DOMAIN" and tblcustdevices.vendor would be blank. And likewise, for a given row, tblcomputers.domain would be blank and tblcustdevices.vendor would be "Acer".
Select 'DEV' as [Type], '' as [Computer Name], tblcustdevices.displayname as [Device Name], '' as [Domain], tblcustdevices.vendor as [Vendor]
FROM tblcustdevices
WHERE tblcustdevices.location LIKE 'Room 150'
UNION
Select 'COMP' as [Type], tblcomputers.computerunique as [Computer Name], '' as [Device Name], tblcomputers.domain as [Domain], '' as [Vendor]
FROM tblcompcustom
INNER JOIN tblcomputers
ON tblcomputers.computername = tblcompcustom.computername
WHERE tblcompcustom.location LIKE 'Room 150'
‎04-18-2012 05:42 PM
Select Top 20 tblCustDevices.Location
From tblCustDevices
Where tblCustDevices.Location Like 'Room 150'
Union
Select tblCompCustom.Location
From tblCompCustom
SELECT TOP 20 tblcustdevices.location
FROM tblcustdevices
WHERE tblcustdevices.location LIKE 'Room 150'
UNION
SELECT tblcompcustom.location
FROM tblcompcustom
WHERE tblcompcustom.location LIKE 'Room 150'
SELECT TOP 100 tblcustdevices.location,
tblcustdevices.displayname,
tblcustdevices.model,
tblcustdevices.vendor AS [Device Vendor]
FROM tblcustdevices
WHERE tblcustdevices.location LIKE 'Room 150'
UNION
SELECT tblcompcustom.location,
tblcomputers.computerunique,
tblcomputers.DESCRIPTION,
tblcomputers.domain AS [My Domain]
FROM tblcompcustom
INNER JOIN tblcomputers
ON tblcomputers.computername = tblcompcustom.computername
WHERE tblcompcustom.location LIKE 'Room 150'
Location Displayname Model Device Vendor
Room 150 Acer LCD Monitor V193W Acer
Room 150 Brother HL-4150CDN HL-4150 Brother
Room 150 Domain\COMP2\1 DOMAIN
Room 150 Domain\COMP3\1 DOMAIN
Room 150 Domain\COMP4\1 COMP4 DOMAIN
Room 150 Domain\COMP5\1 DOMAIN
Room 150 Gateway LCD Monitor FPD1730 Gateway
Room 150 Viewsonic VA2448 VA2448 Viewsonic
Room 150 Viewsonic VA2448 VA2448 SERIES Viewsonic
Room 150 WORKGROUP\NCOMP1\1 COMP1 WORKGROUP
Room 150 Zyxel 4 port Wireless Router NBG-419N Zxyel
‎04-04-2013 06:51 PM
harringg wrote:Select Top 20 tblCustDevices.Location
From tblCustDevices
Where tblCustDevices.Location Like 'Room 150'
Union
Select tblCompCustom.Location
From tblCompCustom
Results in 20 room numbers, including Room 150SELECT TOP 20 tblcustdevices.location
FROM tblcustdevices
WHERE tblcustdevices.location LIKE 'Room 150'
UNION
SELECT tblcompcustom.location
FROM tblcompcustom
WHERE tblcompcustom.location LIKE 'Room 150'
Results in a single result, Room 150.
Expanding the SQL Query to:SELECT TOP 100 tblcustdevices.location,
tblcustdevices.displayname,
tblcustdevices.model,
tblcustdevices.vendor AS [Device Vendor]
FROM tblcustdevices
WHERE tblcustdevices.location LIKE 'Room 150'
UNION
SELECT tblcompcustom.location,
tblcomputers.computerunique,
tblcomputers.DESCRIPTION,
tblcomputers.domain AS [My Domain]
FROM tblcompcustom
INNER JOIN tblcomputers
ON tblcomputers.computername = tblcompcustom.computername
WHERE tblcompcustom.location LIKE 'Room 150'
Results in: (getting closer)Location Displayname Model Device Vendor
Room 150 Acer LCD Monitor V193W Acer
Room 150 Brother HL-4150CDN HL-4150 Brother
Room 150 Domain\COMP2\1 DOMAIN
Room 150 Domain\COMP3\1 DOMAIN
Room 150 Domain\COMP4\1 COMP4 DOMAIN
Room 150 Domain\COMP5\1 DOMAIN
Room 150 Gateway LCD Monitor FPD1730 Gateway
Room 150 Viewsonic VA2448 VA2448 Viewsonic
Room 150 Viewsonic VA2448 VA2448 SERIES Viewsonic
Room 150 WORKGROUP\NCOMP1\1 COMP1 WORKGROUP
Room 150 Zyxel 4 port Wireless Router NBG-419N Zxyel
Is it possible to have the fields from my original device by room report and my computers by room report in one single report? Or are there not enough common fields/field types in the SQL database?
Notice the data from tblcomputers.domain and tblcustdevices.vendor are unique values, but are under the same column. I'd like them each in their own column. So for a given row, tblcomputers.domain would be "DOMAIN" and tblcustdevices.vendor would be blank. And likewise, for a given row, tblcomputers.domain would be blank and tblcustdevices.vendor would be "Acer".
Thanks for getting me this far. If I can get this data in one report, that will be powerful reporting information.
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now