Objective To compare risks of cardiovascular outcomes between patients with type 2 diabetes and patients with established coronary heart disease. Design Cross sectional study and cohort study using routinely collected datasets. Setting Tayside, Scotland (population 400 000) during 198895. Subjects In the cross sectional study, among patients aged 4564, 1155 with type 2 diabetes were compared with 1347 who had had a myocardial infarction in the preceding 8 years. In the cohort study 3477 patients of all ages with newly diagnosed type 2 diabetes were compared with 7414 patients who had just had a myocardial infarction. Main outcome measures Risk ratios for death from all causes, cardiovascular death, and hospital admission for myocardial infarction were calculated by Cox proportional hazards analysis and adjusted for age and sex. Results In the cross sectional study the adjusted risk ratio for death from all causes was 2.27 (95% confidence interval 1.82 to 2.83) for patients who had had myocardial infarction compared with those with diabetes, and the risk ratio for hospital admission for myocardial infarction was 1.33 (1.14 to 1.55). In the cohort study, patients who had just had a myocardial infarction had a higher risk of death from all causes (adjusted risk ratio 1.35 (1.25 to 1.44)), cardiovascular death (2.93 (2.54 to 3.41)), and hospital admission for myocardial infarction (3.10 (2.57 to 3.73)). Conclusions Patients with type 2 diabetes were at lower risk of cardiovascular outcomes than patients with established coronary heart disease.