Forum Replies Created

Viewing 12 posts - 1 through 12 (of 12 total)

  • Reply To: Daily record count based on status allocation

    Thank you all for your replies!

    Sorry if I wasn't clear enough. Although the data I populated the Transfer table with spans a whole month, the desired results table I provided...

    • This reply was modified 2 years ago by  milo1981.
  • Reply To: SQL SUM and divide linked tables

    The cars are not directly associated with any invoice.

    Some invoices (CostCenterAssigned=True) are associated with one ore more Cost Centers and some invoices (CostCenterAssigned=False) are not. The value of those that...

  • Reply To: SQL SUM and divide linked tables

    The connection between Cars and Invoices is based on CostCenter column (this was CarLocation in Cars table, but I renamed it to CostCenter also to make more sense). I modified...

    • This reply was modified 3 years, 5 months ago by  milo1981.
  • Reply To: Inflow / outflow report per day

    Looks like I'll have to migrate to a newer version of SQL. Thank you everyone for their support!

  • Reply To: Inflow / outflow report per day

    I tried using your function but in the function comments it says:

    1. This code works for SQL Server 2008 and up.
    Msg 156, Level 15,...
  • Reply To: Inflow / outflow report per day

    Thank you, Jeff for taking the time to write and comment your response.

    However, I get the following error when I run the script:

    Msg 208, Level 16, State...
  • Reply To: Inflow / outflow report per day

    Thank you, Jeff for taking the time to respond to my question and I'm sorry for my lack of how-to-post knowledge.

    I usually don't post stuff and ask for advice.

    I like...

  • Reply To: Inflow / outflow report per day

    By the way, I'm using SQL Server 2005.

    I've modified my script as suggested by pietlinden:

    WITH D AS (

    SELECT CONVERT(VARCHAR, '2020.11.01', 102) AS d_y_m,

    CAST('2020-11-01' AS DATETIME) AS dt

    UNION...
  • Reply To: Inflow / outflow report per day

    I've managed to add the following line to the script:

    number = ROW_NUMBER() OVER (ORDER BY x.d_y_m)

    So, now I have something to order it by.

    But I can't get it to do...

  • Reply To: Inflow / outflow report per day

    I don't have the column 'Cashflow' in may tables, is what I want to calculate. As ScottPletcher said, I need a running total.

  • Reply To: Inflow / outflow report per day

    Thank you, all, for your answers. Sorry, I posted in a hurry without much details.

    So far, I have the following query:

    WITH D AS (

    SELECT CONVERT(VARCHAR, '2020.11.01', 102) AS d_y_m,

    CAST('2020-11-01' AS...

  • RE: Three tables SQL query

    Hello,

    Thank you all for your replies!

    My progress so far:

    DECLARE @Driver varchar(50),@StartDt datetime, @EndDt datetime

    SELECT @Driver = 'John Doe',@StartDt = '20130101' ,@EndDt = '20130501'

    ;With VehicleAllocation

    AS

    (

    SELECT h.*,h1.ChangeDate

    FROM History h

    OUTER APPLY (SELECT MIN(ReceivedDate)...

Viewing 12 posts - 1 through 12 (of 12 total)