Forum Replies Created

Viewing 15 posts - 2,611 through 2,625 (of 4,085 total)

  • RE: SELECT from Many-to-Many Columns Unique Values from Column 1 and Non-duplicate from Column2

    yb751 (6/1/2016)


    This MIGHT work but I'm not sure since I'm having a hard time understanding your requirement and I have a feeling your example data set isn't reflective of what...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: T-SQL: Aggregate and/or conditional subquery on where clause

    marcossuriel (5/31/2016)


    Hello Drew,

    I replaced the variables with my table names (which are saved and contain data) on my SQL Server, but it does not work. I get "Invalid object name"...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Query Designer vs Query Window Speed

    I never use query designer, because I hate the code that it writes.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: T-SQL: Aggregate and/or conditional subquery on where clause

    marcossuriel (5/31/2016)


    Hello Drew,

    Thanks for your reply. I see that your code starts with:

    ;

    WITH

    I'm getting an error saying that the variable, is some of your code missing?

    Also, I included the...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: T-SQL: Aggregate and/or conditional subquery on where clause

    Even though you said that you attached desired results, I'm not seeing them. Would the following work?

    ;

    WITH LotHistOrdered AS (

    SELECT *, ROW_NUMBER()OVER(PARTITION BY lh.LotNo ORDER BY lh.TransType DESC, lh.TransDate...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Query pagination around multiple select

    Why do you want to skip the first row in subsequent tables?

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Exception handling in SP

    In SQL 2008, you would use RAISERROR rather than THROW. RAISERROR is being deprecated, so you should use THROW if you are on SQL 2012 or higher.

    Drew

    PS: If you...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Query pagination around multiple select

    The reason that we ask for sample data and expected output, is because it is often very difficult to describe in words what you are looking for. Your description...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Query pagination around multiple select

    I think it would be better to approach this as combining the tables into a single output and then applying the OFFSET/FETCH to that single output.

    SELECT *, 1 AS table_num

    FROM...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: How to Combine 6 Reports...?

    Looking at your queries, it looks like you may not realize that you can join to the same table multiple times as long as they have different aliases.

    SELECT *

    FROM Join_Details...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: How to Combine 6 Reports...?

    Please provide sample data and expected results as indicated by the link in my signature.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Need suggestions of synatx for a Date Time Column to allow N/A result

    Yes, return a NULL and let the presentation layer deal with displaying 'N/A' when the field is NULL. It is best to leave this type of formatting to the...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Are the posted questions getting worse?

    RBarryYoung (5/27/2016)


    Anyone else going to SQL Saturday in Philly next week? I don't think I recognized anyone on the speakers list...

    I'm going to be there and both WayneS and...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Simple subquery

    Lynn Pettis (5/26/2016)


    This:

    SELECT [GL Description], SUM(Amount) AS [Prior YTD Amount], Year

    FROM dbo.vlv_PriorYrDetailExpenses

    GROUP BY [GL Description], Year

    HAVING (Year = @Year) AND (Month <= @Month)

    It's going to complain about the Month...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Query calculation over a partition

    SELECT *, CAST(COUNT(sales) OVER(PARTITION BY e.customerId) AS BIT)

    FROM #example e

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 2,611 through 2,625 (of 4,085 total)