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
0
give a positive ratinggive a negative rating
30 Sep 2020 at 04:19 PM
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

0
give a positive ratinggive a negative rating
11 Oct 2020 at 11:36 AM
Tim
Share on FacebookShare on TwitterShare on LinkedInSend email
x
x
2024 AnswerTabsTermsContact us