VIEW erstellt
This commit is contained in:
parent
eb437c3165
commit
014bc5a6de
14
MySQL/View_UsagePerLocation.sql
Normal file
14
MySQL/View_UsagePerLocation.sql
Normal file
@ -0,0 +1,14 @@
|
||||
use inventarisierungsloesung;
|
||||
DROP VIEW IF EXISTS v_usageperlocation;
|
||||
|
||||
SELECT COUNT(devices_id_fk), 'devices_id_fk' FROM interfaces
|
||||
GROUP BY devices_id_fk;
|
||||
|
||||
CREATE VIEW v_usageperlocation AS
|
||||
|
||||
SELECT i.interface_id, l.designation, COUNT(i.devices_id_fk) AS 'Anzahl belegter Port' FROM interfaces i INNER JOIN devices d ON i.devices_id_fk = d.device_id
|
||||
INNER JOIN location l
|
||||
ON d.location_fk = l.location_id
|
||||
GROUP BY i.devices_id_fk;
|
||||
|
||||
SELECT * FROM v_usageperlocation;
|
14
MySQL/View_UsagePerPod.sql
Normal file
14
MySQL/View_UsagePerPod.sql
Normal file
@ -0,0 +1,14 @@
|
||||
use inventarisierungsloesung;
|
||||
DROP VIEW IF EXISTS v_usageperpod;
|
||||
|
||||
CREATE VIEW v_usageperpod (interface_id, ldesignation,idevices_id_fk , pdesignation) AS
|
||||
|
||||
SELECT i.interface_id, l.designation, COUNT(i.devices_id_fk) AS 'Anzahl belegter Port', p.designation FROM interfaces i
|
||||
INNER JOIN devices d
|
||||
ON i.devices_id_fk = d.device_id
|
||||
INNER JOIN location l
|
||||
ON d.location_fk = l.location_id
|
||||
INNER JOIN pointofdelivery p
|
||||
ON l.location_id = p.location_fk;
|
||||
|
||||
SELECT * FROM v_usageperpod;
|
Loading…
Reference in New Issue
Block a user