Untitled

Anonymous
plain_text
10/30/2023 4:25 PM
1.2 KB
32
Indexable
update agents set tot_listing = (SELECT COUNT(*) FROM advertises where advertises.agent_id = agents.id and advertises.is_publish = 1),
                  tot_sell = (SELECT COUNT(*) FROM advertises where advertises.agent_id = agents.id and advertises.is_publish = 4 and advertises.listing_type = 1),
                  tot_rent = (SELECT COUNT(*) FROM advertises where advertises.agent_id = agents.id and advertises.is_publish = 4 and advertises.listing_type = 2),
                  price_min = (SELECT min(price) FROM advertises where advertises.agent_id = agents.id and advertises.is_publish = 1),
                  price_end = (SELECT max(price) FROM advertises where advertises.agent_id = agents.id and advertises.is_publish = 1),
                  price_avg = (SELECT avg(price) FROM advertises where advertises.agent_id = agents.id and advertises.is_publish = 1)
where tot_listing is null
Editor is loading...