Forum Replies Created

Viewing 15 posts - 856 through 870 (of 1,419 total)

  • Reply To: aggregate value by group

    jcelko212 32090 wrote:

    What you posted is by definition not a table at all! The table must have a key. You cannot embed spaces in the data element name in any of...

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

  • Reply To: aggregate value by group

    There are different ways to accomplish this.  Here's one.  In order to use the ROW_NUMBER function in the OUTER APPLY I created a table valued function called dbo.func_reserve_accuracy_amount.  When OUTER...

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

  • Reply To: aggregate value by group

    [Edit] Ok, there were 2 updates above and this post was after the first without having read the second.  So I'm wiping it out.  To be updated if possible

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

  • Reply To: aggregate value by group

    It appears this query meets the requirements, or maybe it's close?  Something like this

    drop table if exists #test;
    go
    create TABLE #test (
    ClaimID int NOT NULL,
    ...

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

  • Reply To: Query

    Please have a look at this article about string splitters.  I think you're looking for something like this

    drop table if exists #stuff;
    go
    create table #stuff(
    sometext...

    • This reply was modified 5 years, 11 months ago by Steve Collins. Reason: Updated with Phil's sample data

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

  • Reply To: Email CSV file

    thunter 5669 wrote:

    We have a stored procedure and job that will email out invoices daily. It all works great, however, we are trying to get the current date in the CSV...

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

  • Reply To: How to iterate through relation records and check every record

    sameer wrote:

    Awesome Steve...u got it.

    i have some question about fol. is it part of that update statement where you use "OUTPUT inserted.book_id into @b-2" and that declaration part where u...

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

  • Reply To: Only return first matches per Id and calculate difference of dates in minutes

    Here's an alternate way of writing the query.  I've been experimenting with windowing functions and I'm pretty sure, but not 100% certain, this is equivalent to Scott's query.  I would...

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

  • Reply To: SQL Query - SUM and JOIN multiple tables but return missing record

    It's missing a comma at the end of line 6.  There's not any sample data so I'm not able to run the code.

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

  • Reply To: How to iterate through relation records and check every record

    It appears you're looking for something that either works completely or fails and completely rolls back.  Something like this try/catch script which doesn't have error handling or parameters.  The reserved...

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

  • Reply To: SQL Query - SUM and JOIN multiple tables but return missing record

    4. There 56 left brackets and 56 right brackets in your code which could/should be replaced by nothing.  They're necessitated by spaces in object names.  Please, please, please never again,...

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

  • Reply To: SQL Query - SUM and JOIN multiple tables but return missing record

    glennyboy wrote:

    i already remove the where clause and add where clause to the left join on, but the return result got wrong quantity in every column

    It's good news we're making...

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

  • Reply To: SQL Query - SUM and JOIN multiple tables but return missing record

    A couple of things

    1.  Opening an xlsx file is going to be a tough sell around here.  Not a good practice.

    2. Table aliases are essential for readable code.  Please choose...

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

  • Reply To: Ignore the entire record if a matching record is found

    Jeff Moden wrote:

    Heh... as a bit of a sidebar, it's nice to see someone use the term "Record" correctly. 😀

    Has a consensus been reached and record = row?  I fear you've...

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

  • Reply To: Ignore the entire record if a matching record is found

    There are a couple of ways.

    The most preferred imo would be to create 'count_grp' using a windowing function and exclude in the WHERE clause of the outer query.

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

Viewing 15 posts - 856 through 870 (of 1,419 total)