Forum Replies Created

Viewing 15 posts - 751 through 765 (of 1,419 total)

  • Reply To: Query is not giving me expected output.

    This seems to return output similar to the picture.  Is it just missing a total row?  What's not working?

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: selecting columns based on condition

    You could unpivot both tables and inner JOIN them.  Here's an example based on another forum question/answer.  Something like this

    drop table if exists #tTableA
    go
    create table #tTableA(
    ...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Are the posted questions getting worse?

    Steve Jones - SSC Editor wrote:

    It was very quick, and I knew about it yesterday, but didn't really do much other than give a vote to try. Still amazed it happened.

    Comments, suggestions, feedback on...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Wrap your SQL into HTTP REST endpoints automagically ^_^

    polterguy wrote:

    The queries ends up wrapping a DataReader in .Net 5, which although technically are created to handle SELECT statements better, still works perfectly for also INSERT/UPDATE/DELETE statements, but you...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Wrap your SQL into HTTP REST endpoints automagically ^_^

    It's an interesting approach.  There are a few questions that jump out tho.  There's no mention of how DML statements like INSERT/UPDATE/DELETE are handled?   Could it execute stored procedures?  How...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Is there anything equivalent to a Last() Function

    drew.allen wrote:

    You know that the LAST_VALUE() is NEVER going to be before the CURRENT ROW, so it's completely unnecessary to specify the beginning of the window as UNBOUNDED PRECEDING when...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Balance is not calculating correctly,when date get change in transection.

    This is sort of confusing because the ORDER BY of the outermost query includes the 'head' column as well as 'Trans_ID'.  The SUM OVER ORDER BY is only by '(select...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Compare columns between 2 tables

    This comes really close.  It uses a FULL JOIN which is functionally both a LEFT JOIN and a RIGHT JOIN.  It seems the example Status_ToolType column might have some consistency...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Sql Joins !

    Should've hit refresh 🙂

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Sql Joins !

    Maybe the correlated subquery in the WHERE clause is converting your LEFT JOIN into an INNER JOIN.  Maybe try expressing OBS as OUTER APPLY SELECT TOP(1) ... instead.

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Spoofing Data Convincingly: Text Data

    Why call it "spoofing" and not "mocking"?  Is spoofing mocking?  Is mocking spoofing?

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Selecting last 6 months

    Instead of approximating the "current" date by selecting the MAX(date) the code could reference CAST(GETDATE() as DATE) to access the system datetime and cast it as type DATE.

  • This reply was modified 5 years, 7 months ago by Steve Collins.

Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Update Column Based on Criteria from Other Columns -- improved post included DDL

    Ugh it's dependent on calculated row values.  Although painful to create, here's a WHILE loop which populates a new table '#myNewTable' with the ID and the derived theoretical_cycle column.  It's...

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Update Column Based on Criteria from Other Columns -- improved post included DDL

    Does it also restart at 0 when aggregating the days?

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Reply To: Update Column Based on Criteria from Other Columns -- improved post included DDL

    The 'max_val' column matches the 'Days_Cycle' column in the table provided.  The 'theoritical_cycle' (in rows where ID is greater than 19) doesn't seem to follow the rules you're suggesting

    Aus dem Paradies, das Cantor uns geschaffen, soll uns niemand vertreiben können

  • Viewing 15 posts - 751 through 765 (of 1,419 total)