Forum Replies Created

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

  • RE: summing data from two tables

    You are on the right track. Here is general idea of the solution I implemented.

    This was provided by Erland Sommarskog and I'll just quote his answer:

    " declare...

  • RE: summing data from two tables

    The above should create these tables:

    Dc1

    cc1c2

    11/0113

    11/0214

    11/0312

    11/0415

    11/0122

    11/0226

    11/0324

    11/0425

    Dc2

    cc1c2

    11/01123

    11/02124

    11/03122

    11/04125

    11/0142

    11/0246

    11/0344

    11/0445

    11/0162

    11/0266

    11/0364

    11/0465

    The select statement produces 10.

    You see how I'm subtracting off the second result from Dc2 because it

    is joined twice with the values in Dc. ...

  • RE: summing data from two tables

    This is the second table and select statement:

    CREATE TABLE dbo.Dc2(c datetime, c1 int, c2 int)

    INSERT

    INTO dbo.Dc2 (c, c1, c2)

    VALUES ('11 / 01 / 02',...

  • RE: summing data from two tables

    I've simplified the issue down to a couple of tables:

    CREATE TABLE dbo.Dc(c datetime, c1 int, c2 int)

    INSERT

    INTO dbo.Dc (c, c1, c2)

    VALUES ('11 / 01...

  • RE: summing data from two tables

    Well, I figured out one way to do it. Divide the second return by two, sum it and subtract from the total.

    I can't help but think there's...

  • RE: summing data from two tables

    Using the statement in this way still results in the cartesian problem. I added statments to sum the ecp and msc numbers for troubleshooting and with this statement the...

  • RE: summing data from two tables

    Yes, thanks, that basically works.

    One problem though:

    Using

    SELECT DISTINCT dn.[Date] AS Date, SUM(dn.MOUs) + SUM(dl.MOUs) AS MOUs, (100 * (SUM(dn.TotBlks) + SUM(dl.TotBlks))) / (SUM dn.TotalAtt) + SUM(dl.TotalAtt))...

  • RE: Autopopulate primary key

    Okay, I figured out the problem. In DTS there is a checkbox that say "enable identity insert." It must be unchecked which seems counterintuitive because identity insert (autopopulation)...

  • RE: Autopopulate primary key

    Yes, thanks. DTS is generating an error when data is loaded. I'm loading from an excel spreadsheet and the error is: "Cannot insert the value NULL into the...

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