Forum Replies Created

Viewing 15 posts - 796 through 810 (of 1,424 total)

  • Reply To: get data from two sql server table

    Please post the CREATE TABLE Data Definition Language (DDL) of both of your tables.  Without knowing how the keys (PK_POSTE , FK_POSTE) and constraints are defined we don't have enough...

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

  • Reply To: get data from two sql server table

    Using conditional aggregation

    select NAME_POSTE, 
    max(iif(NAME_PARAM='NamePrinter', VALUE_PARAM, null)) NamePrinter,
    max(iif(NAME_PARAM='PathPrinter', VALUE_PARAM, null)) PathPrinter
    from #P p
    ...

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

  • Reply To: How to make pivot to feature values based on part ca and x exist on input data ?

    Here's a non-dynamic query to produce the output.  If there's a variable number of features then it would need to be dynamic.

    select id.PartIdC, id.PartIdX,
    ...

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

  • Reply To: Towards an efficient interface between application and database

    Steve Collins wrote:

    One way or another I would like to come up with a way to deal with JSON schemas.  If I observe how my time is spent and do the...

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

  • Reply To: How to get zplid that have two code type one code type have Null on zfeature key

    with zpl_cte(Zplid) as (
    select Zplid
    from #gen
    group by Zplid
    having count(*)=3
    ...

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

  • Reply To: Subtract running amount

    Jeff Moden wrote:

    Steve Collins wrote:

    I did find some old documentation for SQL Server 2005 which says the SUM function may be followed by the OVER clause.

    Yep... and I didn't...

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

  • Reply To: nested while

    mtz676 wrote:

    thanks for the response but I need it only with a nested while loop.

    Don't re-use @I.  Come up with a new variable to store the counter for the inner...

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

  • Reply To: Inventory Running Total & calculations

    To fix the first issue you could add 'order_num' to the GROUP BY clause.

    Not sure why 'Dry Feed' doesn't show.  It's using an equivalent of the 'Dry Feed' WHERE clause...

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

  • Reply To: nested while

    Why is this necessary?  Here's a solution using (two of) the fnTally function to generate the rows instead of WHILE loops.  Re-using declared variables is generally not a good...

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

  • Reply To: Inventory Running Total & calculations

    Sorry it's been a busy day!  Please give this a try

    declare
    @start datetime='2020-11-29 00:00:00.000',
    @end ...

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

  • Reply To: Inventory Running Total & calculations

    The second post makes the first one clearer.  In the first post the 2nd query in the statement containing UNION ALL is the only place where 'Dry Feed' is defined...

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

  • Reply To: Inventory Running Total & calculations

    It's not fully explained imo.  The SELECT above the UNION ALL is summarizing 'Wet Feed' tons per hour?  The SELECT below the UNION ALL is 'Dry Feed'?  It appears you're...

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

  • Reply To: Inflow / outflow report per day

    Jeff Moden wrote:

    Again, can't use SUM() OVER for the running total on this one.  The OP said he's actually using 2005.

    The OP said they're going to migrate to a newer version. ...

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

  • Reply To: Inflow / outflow report per day

    After the update the code could look something like this

    drop TABLE if exists #Invoices
    go
    CREATE TABLE #Invoices(
    [InvoiceID] [int] IDENTITY(1,1) NOT NULL,
    [InvoiceDate] [smalldatetime] NULL,
    [Total] [decimal](18, 2) NULL,
    CONSTRAINT [PK_Invoices] PRIMARY...

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

  • Reply To: how to check all the delete and update rules on the foreign keys tables

    The lazy programmers' way to delete from complex data structures is to get a data comparison tool to generate the SQL DELETE transaction.  Where I work we've used 2 different...

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

Viewing 15 posts - 796 through 810 (of 1,424 total)