IntroductionTo explore the relationship between serum 25(OH)D, cadmium, and CRP with all-cause mortality among people in diabetic and non-diabetic.MethodsThis study used data from the NHANES (2001–2010). Cox regression was used to analyze the relationship between Serum 25(OH)D, cadmium, CRP, and all-cause, cause-specific mortality. We used restricted cubic splines to explore the dose-response relationship between serum 25(OH)D, cadmium, CRP, and all-cause mortality.ResultsDuring a mean follow-up of 9.1 years, the study included 20,221 participants, 2,945 people with diabetes, and 17,276 people without diabetes. Compared with serum 25(OH)D deficiency group in diabetic patients, the sufficient serum 25(OH)D group was associated with lower all-cause mortality (HR = 0.41, 95%CI 0.28-0.60, P < 0.001) and cardiovascular mortality (HR = 0.46, 95%CI 0.22–0.95, P = 0.04). Compared with the low cadmium group, the high cadmium group was associated with higher all-cause mortality (HR = 1.49, 95%CI 1.06–2.09, P = 0.02). Compared with the low CRP group, the high CRP group was associated with higher all-cause mortality (HR = 1.65, 95%CI 1.24–2.19, P = 0.001) and cancer mortality (HR = 3.25, 95%CI 1.82–5.80, P < 0.001). Restricted cubic splines analysis showed a significant nonlinear association between serum 25(OH)D (P-nonlinearity P < 0.001), cadmium (P-nonlinearity = 0.002), CRP (P-nonlinearity = 0.003), and HR for all-cause mortality risk in diabetic patients. The results were similar among non-diabetic patients, but with different levels of risk. Sensitivity analysis and subgroup analysis presented the results of population studies with different follow-up times, different genders and ages.ConclusionsIn diabetic patients, serum 25(OH)D, cadmium, and CRP were related to all-cause mortality; serum 25(OH)D was related to cardiovascular mortality; CRP was related to cancer mortality. The results were similar among non-diabetic patients, but with different levels of risk.