I am seeing a really weird issue from mysql, doing an update that includes a join - which is a weird idea in and of itself, but something mysql supports
Code:
update dash_samples s
join (
select dash_sample_id, sum(cst.severity)/5 as severity
from dash_samples
join dash_cuckoo_signatures cs using (dash_sample_id)
join dash_cuckoo_signature_types cst using (dash_cuckoo_signature_type_id)
{where}
group by 1
) x using (dash_sample_id)
set s.severity=x.severity
So in english this is saying, "do this calculation involving another query, join it with our main table, and update every matching row from the joined query"
It successfully updates s.severity
It *also* updates s.hit_date, which is a timestamp field, to the current date - only for rows in dash_samples that are updated. I really can not figure out why.
{where} gets replaced by whatever where clause I'm using - usually it's "s.hit_date between SOMEDATE and OTHERDATE"