Hello,

Firstly, the FROM_UNIXTIME function's date pattern is case sensitive :

*         FROM_UNIXTIME(1451308548, 'yyyy-MM') --> 2015-12

*         FROM_UNIXTIME(1451308548, 'YYYY-MM') --> 2016-12 (because YYYY is not 
a valid date pattern and 2016 is the current year)

Consider the following query (dual is the oracle 1 row table) :
SELECT
  FROM_UNIXTIME(ts, 'yyyy-MM'),
  FROM_UNIXTIME(ts, 'YYYY-MM')
FROM (
  SELECT 1451308548 AS ts FROM dual -- Timestamp for the 2015-12-28 date
  UNION
  SELECT 1482930948 AS ts FROM dual -- Timestamp for the 2016-12-25 date
) dual
GROUP BY FROM_UNIXTIME(ts, 'YYYY-MM')

The query should throw an error because there is a field in the SELECT clause 
which is not present in the GROUP BY clause (without an aggregate function).
In deed the previous query returns only one row (from the 2016-12 value from 
the GROUP BY) but there is 2 distinct values (2015-12 and 2016-12) for the 1st 
field in the SELECT CLAUSE.

Is this an intended behavior ?

Best regards,
Samuel Picquenot


__________  L'intégrité de ce message n'étant pas assurée sur Internet, la 
société i-BP ne peut être tenue responsable de son contenu. Si vous n'êtes pas 
destinataire de ce message, merci de le détruire et d'avertir l'expéditeur.  
The integrity of this message cannot be guaranteed on the Internet. The i-BP 
company cannot therefore be considered responsible for the contents. If you are 
not the intended recipient of this message, then please delete it and notify 
the sender.  __________

Reply via email to