-2

I have this kinda complicated query that is well explained in this question. I haven't changed anything in the query or anything relating to this system , however I suddenly started getting this error

BIGINT UNSIGNED value is out of range in '(_db.ads.impressions_total - (cast(((curdate()) - cast(_db.ads.start as date)) as unsigned) * _db.ads.impressions_perday))'

I'm really confused, I guess something is not caching right but what can I do? I really need help..

Community
  • 1
  • 1
php_nub_qq
  • 15,199
  • 21
  • 74
  • 144

1 Answers1

1

This appears to be your

(_db.ads.impressions_total - (cast(((curdate()) - cast(_db.ads.start as date)) as unsigned) * _db.ads.impressions_perday

The proper way to get the difference between two dates is to use datediff(). So I wonder if this will solve your problem:

_db.ads.impressions_total - datediff(curdate(), cast(_db.ads.start as date))*_db.ads.impressions_per_day
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786