Forum Replies Created

Viewing 15 posts - 181 through 195 (of 1,413 total)

  • Reply To: How to find ultimate parent

    All perfect parents have the same thing in common.  No kids

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

  • Reply To: Can’t return role based on employee no from three columns?

    Also my code assumes the RequestNo is UNIQUE NOT NULL and has appropriate sequential values.  The DDL provided says the RequestNo is NULL-able

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

  • Reply To: Can’t return role based on employee no from three columns?

    drop TABLE  if exists #F6000059;
    go
    CREATE TABLE #F6000059
    (
    [RequestNo] [int] NULL,
    [REAN82] [int] NULL,
    [REAN83] [int] NULL,
    ...

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

  • Reply To: SQL Query help

    It seems like you're looking for an UPDATE statement

    /* select using OUTER APPLY and TOP(1) */
    select t.id, t.code, t.result, prev.result prev_result,
    ...

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

  • Reply To: Time intervals with Number of Employees

    Alfred wrote:

    ...

    In source table each row is allways for one date, so if the work shift continues over midnight it's broken into two parts. But for expected output the time...

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

  • Reply To: Loop query help

    rocky_498 wrote:

    Thanks, Drew for your reply. Did you bother to read my latest post? and did you bother to run the query that I provided?

    IF yes, then my question was...

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

  • Reply To: Loop query help

    drew.allen wrote:

    I also did a comparison of my query with Steve's query.  Here are the read stats.  Specifically note the scan counts and logical reads on the 'Worktable'.

    Using the preceding...

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

  • Reply To: Loop query help

    Afaik the set up is not clear.  This seems to produce the correct result

    with
    gaps_cte as (
    select *, case when crit<>lag(crit) over (order by...

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

  • Reply To: T-SQL | Group Invoices with concern dates that overide the issue date

    Phil Parkin wrote:

    This took a while, but was fun! There are a couple of characters in this forum who like to come along and make my code run 17 times faster,...

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

  • Reply To: Select a distinct list of values from tables, return the dataset

    Phil Parkin wrote:

    ... it assumes that you know in advance which of the columns has the most distinct items ('Line' in your example, but 'Division' in mine).

    One way to generalize the...

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

  • Reply To: Opening and closing with date filter is not giving me correctly output

    Ok the set up and explanation are appreciated.  Right off the bat tho there's an issue (which is hopefully a typo) with the sample data.  In the #tbl_transection table in...

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

  • Reply To: Opening and closing with date filter is not giving me correctly output

    akhterhussain80 wrote:

    I want ...

    Keep at it you're on the right track.  Your query doesn't seem to return any error so what's the question?  What's Wrong Output and Correct Output seems...

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

  • Reply To: Need help on query within 2 column, generate another column

    It appears the math in your example calculation is off (by 300.00) beginning on line 3: instead of 21.37 should it not be 321.37?

    select 21.37 + (11033.21)...

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

  • Reply To: How to Implement

    Is x a column in table A?  It seems so.  The SQL language does not support dynamic join types or JOIN conditions derived within a WHERE clause based on CASE...

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

  • Reply To: extracting data from JSON with TSQL

    Ken McKelvey wrote:

    There is probably a better method:

    Well I came up with pretty much the identical query.  Joining the rows back together using the array keys seems unavoidable.  In SQL Server...

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

Viewing 15 posts - 181 through 195 (of 1,413 total)