Gustav Brock
Gustav at cactus.dk
Fri May 11 09:28:09 CDT 2007
Hi Martin You could try with TOP 1: SELECT TOP 1 [stdnt_nbr],[pos_crse_cd],[prsn_nbr],date_start_appntmnt, MAX ( [date_start_appntmnt] ) FROM [s335_stdnt_staff] WHERE [stdnt_nbr] = XXXXXXXXXXXXXXXXXX GROUP BY [stdnt_nbr],[pos_crse_cd],[prsn_nbr], date_start_appntmnt /gustav >>> mwp.reid at qub.ac.uk 11-05-2007 16:20 >>> Running hte following returns three rows. I need it to return asingle row. Is there something missing. This is SQL Server 2005. The WHERE is ismply used for testing to restirct this to a single student., SELECT [stdnt_nbr],[pos_crse_cd],[prsn_nbr],date_start_appntmnt, MAX ( [date_start_appntmnt] ) FROM [s335_stdnt_staff] WHERE [stdnt_nbr] = XXXXXXXXXXXXXXXXXX GROUP BY [stdnt_nbr],[pos_crse_cd],[prsn_nbr], date_start_appntmnt Martin WP Reid Training and Assessment Unit Riddle Hall Belfast tel: 02890 974465