SELECT cu.id as user_id, if(date_diff(current_date,date(last_location_at),DAY) > 190,null,longitude) longitude, if(date_diff(current_date,date(last_location_at),DAY) > 190,null,latitude) latitude, last_location_at FROM `reby-cloud.alvaro_misc.pg_user_last_location` ull left join `reby-cloud.reby_marketing_eu.pg_company_user` cu on cu.company_id = ull.company_id and cu.user_id = ull.user_id join `reby-cloud.temp_eu.200_users_aepd_avant` aepd on aepd.from_co_cu_id = cu.id ;
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter