SELECT
e.PartitionByDeviceId,
e.deviceid,
e.UnixTime,
e.MessageParsedTimestamp,
e.Latitude,
e.Longitude,
e.ObdVIN,
e.Address,
ST_WITHIN(createpoint(e.latitude,e.longitude), arrayElement.ArrayValue.geometry)
as Inbound
FROM geoinput as e
CROSS JOIN georef as event
CROSS APPLY GetArrayElements(event.features) AS arrayElement