Jump to content

MYSQL need report for weekly profits


simeonC

Recommended Posts

  • 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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.