Forum Replies Created

Viewing 8 posts - 1 through 9 (of 9 total)

  • RE: Left join NULLs

    Calc1 would be f.ForecastValue and Calc2 would be d.DeliveryValue

     

  • RE: Left join NULLs

    Point taken....

    Thx a lot guys, I having a bit of a struggle on this one.

    CREATE TABLE [MeasurementLog] (

     [MeasurementLogID] [int] IDENTITY (1, 1) NOT NULL ,

     [MeasurementLogTimeStamp] [datetime] NOT NULL CONSTRAINT [DF_MeasurementLog_MeasurementLogTimeStamp]...

  • RE: Left join NULLs

    Thx for trying to help!

    I did actually exactly what you did (did not submit it to see you you guys did't in a diffrent way) and that works great for the...

  • RE: Left join NULLs

    oh sorry...

    So when ml.MeasurementLogValue is NULL then I want to take the last value that is not NULL from ml.MeasurementLogValue and substract f.forecastValue and add d.deliveryValue, if more rows have...

  • RE: Left join NULLs

    Here it comes..

    SELECT f.TankObjectID,

      f.ForecastDate,

      f.ForecastValue,

     Case

      when ml.MeasurementLogValue IS NOT NULL then

     ml.MeasurementLogValue

      Else

     "Here's where I need the logic to preform that calculation"

     End MeasurementLogValue,

      d.DeliveryValue,

      f.CustomerReference,

      d.SupplierReference

    FROM...

  • RE: Left join NULLs

    Hi agin,

    That far I did get as well, that biggest problem for me that I don't find a good approach to the last isuue e.g. per my first example on the...

  • RE: Left join NULLs

    Thx, but I think I need a bit more pointers to head me in the right direction...

    The actual query without an attempt to fix the null issue.

    SELECT f.TankObjectID,

     f.ForecastDate,

     f.ForecastValue,

     ml.MeasurementLogValue,

     d.DeliveryValue,

     f.CustomerReference,

     d.SupplierReference

    FROM dbo.Forecast f

    LEFT...

  • RE: Left join NULLs

    ok, sorry guys for the lack of info, here you go..

    Expected result:

     

    Date           LoggedValue     Calc1       Calc2

    2007-06-11 '200'                100         200

    2007-06-12 '300'                100         0

    2007-06-13 '200'                 100         300

    So here's  how is should...

Viewing 8 posts - 1 through 9 (of 9 total)