select DISTINCT two date from table using repeater with custome query

web dev asked on January 5, 2019 15:34

hello kentico dev i use repeater with custome query to display two date (NewsStartDate,NewsEndDate) and here is my query (SELECT DISTINCT NewsStartDate,NewsEndDate FROM cms.news order )i but i dont get unique date is there some thing to change thanks

Recent Answers


Brenden Kehren answered on January 5, 2019 16:02

They will be distinct if both dates are the same for 2 or more records. So your records would show grouped together if you had values like so:

Record 1: 01/04/2019 09:00:00 01/04/2019 17:00:00

Record 2: 01/04/2019 09:00:00 01/04/2019 17:00:00

If even the time is off by 1/10 of a second they are not considered the same values so you won't get unique values. If you're looking to get unique dates you should exclude the time in your query and cast it to a short date value.

0 votesVote for this answer Mark as a Correct answer

web dev answered on January 5, 2019 16:09

hello Brenden Kehren thanks for answer can i see example thanks

0 votesVote for this answer Mark as a Correct answer

web dev answered on January 5, 2019 16:38

Elsa Black this is not exactly what i was looking for i need to display unique date using custom query query (SELECT DISTINCT NewsStartDate,NewsEndDate FROM cms.news order )

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.