Lorsque j'utilise trunc(timestamp, 'D')
, cela me donne toujours le lundi de cette semaine. Est-il possible de demander à la fonction de revenir un autre jour de la semaine, tel que mardi? Merci!Impala: jour de retour de la fonction intégrée trunc()
0
A
Répondre
0
Vous devez utiliser . Consultez la documentation de jour, vous utilisez 'jour A partir de la semaine':
trunc(timestamp, string unit)
Purpose: Strips off fields from a TIMESTAMP value.
Unit argument: The unit argument value is case-sensitive. This argument string can be one of:
SYYYY, YYYY, YEAR, SYEAR, YYY, YY, Y: Year.
Q: Quarter.
MONTH, MON, MM, RM: Month.
WW, W: Same day of the week as the first day of the month.
DDD, DD, J: Day.
DAY, DY, D: Starting day of the week. (Not necessarily the current day.)
HH, HH12, HH24: Hour. A TIMESTAMP value truncated to the hour is always represented in 24-hour notation, even for the HH12 argument string.
MI: Minute.
https://www.cloudera.com/documentation/enterprise/latest/topics/impala_datetime_functions.html
0
facile, il suffit d'essayer SELECT TRUNC (horodatage, 'D') + INTERVALLE 1 JOUR;