PHILADELPHIA (CBS) — It is tough to go to work on Monday morning, but for some people, it could actually be bad for their health.

According to a new study, if you hate your job in your late twenties and thirties, it is going to affect your health in your forties.

Over 6,000 people were tracked in the study.

Researchers found those who are unhappy early in their careers report being more depressed, worried, and having trouble sleeping later in life.

Researchers say the good news is that people whose job satisfaction started low, but got better over time didn’t have the health problems associated with consistently low or declining satisfaction.

“We found that there is a cumulative effect of job satisfaction on health that appears as early as your 40s,” says Jonathan Dirlam, lead author of the study.

“Increased anxiety and depression could lead to cardiovascular or other health problems that won’t show up until they are older,” says Hui Zheng, who conducted the study with Dirlam.

The physical health of those who were unhappy with their jobs wasn’t impacted as much as mental health, the study found.