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 Link to comment https://forums.phpfreaks.com/topic/278973-mysql-need-report-for-weekly-profits/ Share on other sites More sharing options...
Barand Posted June 9, 2013 Share Posted June 9, 2013 WHERE date > curdate()-INTERVAL 7 day Link to comment https://forums.phpfreaks.com/topic/278973-mysql-need-report-for-weekly-profits/#findComment-1435044 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 Link to comment https://forums.phpfreaks.com/topic/278973-mysql-need-report-for-weekly-profits/#findComment-1435049 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.