SQL Adding first discovered and last discovered

I have this sql query that shows unauthenticated/authenticated with certainty but i need first discovered and last discovered added to it: I know I can use the fad.first_discovered, fad.last_discovered but can’t figure out where my from clause can go if i already have fac_asset as fa…

I also want the

SELECT dsite.“name” as “Site”, da.ip_address, da.host_name, dos.description as “OS”, os.certainty_max

FROM fact_asset AS fa

JOIN dim_asset da ON da.asset_id = fa.asset_id


  SELECT asset_id, MAX(certainty) as certainty_max

  FROM dim_asset_operating_system

  GROUP BY asset_id

) os ON fa.asset_id = os.asset_id AND os.certainty_max < 1

JOIN dim_operating_system as dos

ON da.operating_system_id = dos.operating_system_id

JOIN dim_site_asset as dsa

ON fa.asset_id = dsa.asset_id

JOIN dim_site as dsite

ON dsa.site_id = dsite.site_id

GROUP BY dsite.“name”, da.ip_address, da.host_name,dos.description, os.certainty_max

ORDER BY “Site”, da.ip_address

Can you rephrase/format your question? I think you are asking to add the first_discovered and last_discovered fields from the fact_asset_discovery table, but its hard to tell. Also, any reason you are using fact_asset?

No reason just the way i was able to make the sql work. I think i asked my question wrong i was wanting last scan date and first discovered.