I have the following table structure
'category_id', 'int(11)', 'PRI'
'page_id', 'int(11)', 'PRI'
'current_week_visits', 'int(11)'
I keep updating the current week visits daily on this table and I would like to insert a row if (app_id, page_id) is not present in the table. Else, update the current_week visits
I tried,
INSERT INTO visits (category_id, page_id, current_week_visits) VALUES (150, 1, 100) ON DUPLICATE KEY UPDATE current_week_visits = current_week_visits + 100;
But it does not seem to save the current week visits. Could you throw some light on what's wrong here?