Jump to content

MYSQL need report for weekly profits


simeonC
Go to solution Solved by Barand,

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.