Skip to content

Tag: mysql

How to Update table row using regex

I have a table with rows like this: and I want to update my rows to keep only normal data and delete data inside “()” I’m wondering if there is a way to use regex inside my SQL update statement to delete all data after ” (” Answer You must use 2 SUBSTRING_INDEX like this if there…

Use UNIX_TIMESTAMP on update instead of timestamp

I want to add a column with a unix timestamp to see when the row was last altered. So far i could only figure out how to add a column with timestamp format. Is there any solution to use a unix timestamp – something like this: UPDATE: similar question As far as i understand this thread only shows how to

Mysql Sum daily totals into weekly totals for given date range

Currently my db table has dailTotal values for every single day, I need to get these grouped into weekly totals. Is it possible to add the daily totals up into weekly totals and display a row each weekly total between the given date range. Im not quite sure where to start with this one. My current query to ge…