1SELECT TOP 1002       h.PROCHI,3       d.sex,4       d.Calculated_Age,5       h.DateTimeSampled,6       h.LocalClinicalCodeDescription,7       h.QuantityValue,8       h.QuantityUnit,9       h.RangeLowValue,10       h.RangeHighValue,11       h.Interpretation12FROM Project_12345..HaematologyRestructured h13INNER JOIN Project_12345..Demography_Current d14    ON h.PROCHI = d.PROCHI15ORDER BY NEWID()
1with engine.connect() as conn:2    df = pd.read_sql("""3        SELECT TOP 1004               h.PROCHI,5               d.sex,6               d.Calculated_Age,7               h.DateTimeSampled,8               h.LocalClinicalCodeDescription,9               h.QuantityValue,10               h.QuantityUnit,11               h.RangeLowValue,12               h.RangeHighValue,13               h.Interpretation14        FROM Project_12345..HaematologyRestructured h15        INNER JOIN Project_12345..Demography_Current d16            ON h.PROCHI = d.PROCHI17        ORDER BY NEWID()18    """, conn)19 20df.head()
1df <- dbGetQuery(conn, "2    SELECT TOP 1003           h.PROCHI,4           d.sex,5           d.Calculated_Age,6           h.DateTimeSampled,7           h.LocalClinicalCodeDescription,8           h.QuantityValue,9           h.QuantityUnit,10           h.RangeLowValue,11           h.RangeHighValue,12           h.Interpretation13    FROM Project_12345..HaematologyRestructured h14    INNER JOIN Project_12345..Demography_Current d15        ON h.PROCHI = d.PROCHI16    ORDER BY NEWID()17")18 19head(df)