2 Replies Latest reply on Mar 25, 2016 12:13 AM by luke.koplitz.0

    SQL GroupBy in Calculated field

    Sushma Nayak

      I have 4 columns :         

       

      Order Number Line Item Start Date End Date
      1118/02/201401/01/2016
      1218/02/201423/11/2015
      1318/02/201423/11/2015
      2101/06/201501/06/2015
      2201/06/201501/03/2016
      3101/10/201401/06/2015
      4116/06/201501/09/2015
      4216/06/201501/12/2015
      4316/06/201501/12/2015
      4416/06/201515/06/2015

      I need to find no of days a order took to complete.

       

      It would be Datediff('day',end date,start date). but the value returned is for each row. i want difference for one order. Is it possible to group by order number and get the difference by taking the min start date and max end date for a particular order?