This is in sqlite 3
I have location numbers and addresses in one table (stored as CHAR)
I have device names and other details in another table, where device names are stored as CHAR and the location number is a substring or equal with the device name
I would like to be able to select all the locations and calculate the number of devices that are at that location based,grouped by the location number
Here is what I am using
SELECT v.[TransitNumber],DeviceName,count(NeighborName) from Neighbors n left join VirtualControllers v on v.TransitNumber like '%'+n.DeviceName+'%' group by DeviceName
This returns me Null for the value of the transit number and I don't undertand why
Here is some data
TransitNumber DeviceName count(NeighborName)
712bs1 2
712bs2 2
the transit number should have been 712 In this case (BTW I am actually counting how many PC are connected to each device but I would like to get how many PCs are in that location
The result should be
TransitNumber count(NeighborName)
712 4
Aucun commentaire:
Enregistrer un commentaire