0

i'm using a query :

SELECT 
         t.tID,  
         min(t.CONTEXTTIMESTAMP) contextTime,  
         CONCAT(' ',CONCAT(ac.NAME, CONCAT('=',ac.VALUE))) as idf 
FROM TABLE1 t 
  INNER JOIN ( select t.tID, t.COLOR, t.ETAT )
  INNER JOIN TABLE2 ac ON t.tID = ac.tID 
WHERE 
        t.CONTEXTTIMESTAMP BETWEEN '29/05/20 11:36:21' AND '26/06/20 11:36:21' 
GROUP BY 
        t.tID,ac.NAME, ac.VALUE     
ORDER BY 
        contextTime desc 

What i would like to do is not adding ac.NAME, ac.VALUE in my group by because it make me lose some of the rows i'm looking for. I have been looking for solutions but didnt find anything relevant.

Thanks for your help

  • 1
    What are you trying to do? – Michael Kutz Jul 2 at 14:53
  • If the column isn't using a group function, then it must be in the "group by" clause. – pmdba Jul 2 at 20:52
  • if you do not want ac.NAME, ac.VALUE in your group by clause then remove it from the group by clause and the select clause – miracle173 Jul 3 at 6:03
  • the problem is i need to get the idf value for my table – Dallincha Jul 3 at 7:42
  • And if it stay in the group by, i lose some results which have the same idf, thats my problem actually, i need all of them – Dallincha Jul 3 at 7:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.