simeonC Posted June 9, 2013 Share Posted June 9, 2013 Software: MySQL Software version: 5.5.29 - Source distribution my table is constructed as such CREATE TABLE `parts` ( `name` char(100) NOT NULL, `price` float(6,2) NOT NULL, `qty` int(11) NOT NULL, `total_price` float(6,2) NOT NULL, `profit` float(6,2) NOT NULL, `car_id` int(11) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, KEY `car_id` (`car_id`), ) ENGINE=InnoDB DEFAULT CHARSET=latin1; Well I really have no idea what I am doing. I am not fimiliar with the time_functions in mysql. Basically what I would like to achieve is a result set which extract weekly profits as days goes by and resets the following week. I attempted the following code: SELECT profit FROM parts WHERE date=curdate()-INTERVAL 7 days this returns nothing. I would like for only the items inserted for this current week be fetched to display profits Thank you hopefully this was clear Quote Link to comment Share on other sites More sharing options...
Solution Barand Posted June 9, 2013 Solution Share Posted June 9, 2013 WHERE date > curdate()-INTERVAL 7 day Quote Link to comment Share on other sites More sharing options...
simeonC Posted June 9, 2013 Author Share Posted June 9, 2013 Thank you hopefully one day i become as wise as you master Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.