SQL query to fetch the instance id, tags ,last activity ,OS, OS version ,Last enrolled ,OSQ version, Gateway IP ,Interface Name ,IP ,asset group
select ua.host_name as Hostname,
ua.id as InstanceID,
ua.tags as TAGS,
ua.last_activity_at as LastActivity,
ua.os as OperatingSystem,
ua.os_version as OSVersion,
ua.last_enrolled_at as LastEnrolled,
ua.osquery_version as OSQVersion,
ua.gateway as "GatewayIP",
uai.name as InterfaceName,
uai.ip as InterfaceIP ,
(select name from upt_asset_groups where id=ua.upt_asset_group_id) as asset_group
from upt_assets ua,
upt_asset_interfaces uai
where ua.host_name = uai.upt_hostname and ua.live=true