Forum Discussion

mike_asplin's avatar
mike_asplin
Helper V
1 year ago
Solved

Trying to use SQL to calculate a max excluding certain lines

Way beyond my SQL abilties   I tried this code   SELECT StudyCode , MAX( Date_ScheduledPulldate) as 'Trial End Date' FROM Custom_PullPointDate WHERE Recordstatus=1 AND NOT CONTA...
  • bhanu_gautam's avatar
    1 year ago

    mike_asplin , Try using

    SELECT
    StudyCode,
    MAX(Date_ScheduledPulldate) AS 'Trial End Date'
    FROM
    Custom_PullPointDate
    WHERE
    Recordstatus = 1
    AND TestGroup NOT LIKE '%SET UP%'
    AND TestGroup NOT LIKE '%SET DOWN%'
    AND TestGroup NOT LIKE '%COLLECTION%'
    GROUP BY
    StudyCode