Using CONVERT with MIN or MAX in SQL SELECT
I need to use CONVERT together with MAX and MIN in SQL SELECT, but the code below is not working. Is it possible to use these functions together or something is incorrect in my code ?
SELECT id, user CONVERT( date, max(registration_date) )
FROM users
WHERE user LIKE 'abc'
GROUP BY user
Hi,
To convert the date according to your needs, you have to include CONVERT into MAX function. The using of these functions together should look like:
SELECT id, user, MAX( CONVERT( date, registration_date) )
FROM users
WHERE user LIKE 'abc'
GROUP BY user