3 Replies Latest reply on Sep 13, 2016 8:24 AM by Luciano Vasconcelos

    Error with date function when declared

    john.christopher

      Hi ,

       

      Below is the same query whether we declare the data and try to pull it in the sub query,but tableau throw an error.We had to delete the first two lines and manually type in the date part to get the results

       

      DECLARE @cdate AS DATETIME

      SELECT @CDate = (SELECT MAX(Date) from ABC)

       

       

      Select * from abc from

        (

        select *

        from xyz

        WHERE xyz.Date >  DATEADD(dd, -30, @cDate)

        GROUP BY CDate

      ) as tmp

       

      Does tableau support such queries or is there any workaround.Your answers are much appriciated.

       

      Regards,

      JC