Getty Images People unhappier in their jobs early in their careers are also the most prone to illness, particularly mental health problems, in their 40s, a study has found.

Having a job you dislike not only sucks, it might also be impacting your health.

Job-related dissatisfaction experienced in your 20s and 30s can lead to overall health issues just 10 or 20 years down the line, according to a new study from the American Sociological Association.

“We found that there is a cumulative effect of job satisfaction on health that appears as early as your 40s,” said lead author Jonathan Dirlam, a doctoral student in sociology at Ohio State University.

Dirlam and his team analyzed data from over 6,000 participants in the National Longitudinal Survey of Youth, which has been tracking outcomes of participants since 1979.

The researchers examined the participants’ job satisfaction trajectories from age 25 to 39, and then compared that data with the health conditions reported by the same participants after they turned 40.

What they discovered was people who were unhappier in their jobs early in their careers were also the most prone to illness, particularly mental health problems, in their 40s. They were more depressed, had more emotional issues and sleep problems and suffered from excessive worry.

Physical ailments were also more likely, though to a lesser degree. Those with lower job satisfaction tended to report more problems like back pain and frequent colds than those who were happier at work.

“We found that those with lower job satisfaction levels throughout their late 20s and 30s have worse mental health compared to those with high job satisfaction levels,” Dirlam told CBS News. “Those who initially had high job satisfaction but downwardly decreased over time also had worse health.”

Co-author Hui Zheng, an associate professor of sociology at Ohio State, said the findings reveal the importance that early jobs have on people’s lives and well-being.

“You don’t have to be near the end of your career to see the health impact of job satisfaction, particularly on your mental health,” he said.

Zheng added that though researchers found little difference in other health problems like cancer and diabetes, those issues might be expected later in life among those with lower job satisfaction levels.

“The higher levels of mental health problems for those with low job satisfaction may be a precursor to future physical problems,” he said. “Increased anxiety and depression could lead to cardiovascular or other health problems that won’t show up until they are older.”

The study, presented on Aug. 22 at an annual meeting of the ASA, supports earlier research that suggests a clear correlation between job satisfaction and health.

In a 2003 meta-analysis of 485 studies on the subject, job satisfaction was found to be strongly associated with psychological problems such as burnout, depression and anxiety. A modest link between job happiness and physical illness was also found.

Job satisfaction is “an important factor influencing the health of workers,” the authors of the analysis concluded.

“Organizations should include the development of stress management policies to identify and eradicate work practices that cause most job dissatisfaction as part of any exercise aimed at improving employee health,” the authors advised. “Occupational health clinicians should consider counselling employees diagnosed as having psychological problems to critically evaluate their work— and help them to explore ways of gaining greater satisfaction from this important aspect of their life.”