Forum Replies Created

Viewing 15 posts - 2,326 through 2,340 (of 4,085 total)

  • RE: make over columns using comma seperated and select in query

    mcfarlandparkway (9/28/2016)


    TY for the response, In the recent code we are selecting data form temp table where DOC NOT IN (select DOC from table where code<> -1)

    This is what the...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Searching for a value across all columns of a single table

    SELECT v.*

    FROM (

    VALUES

    (1, 'True', 'True', 'True', 'True', 'True', 'True'),

    (2, 'True', 'True', 'True', 'True', 'True', 'True'),

    (3, 'True', 'True', 'True', 'True', 'True', 'True'),

    (4, 'True', 'True', 'True', 'False', 'False', 'True'),

    (5, 'True', 'True', 'True',...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Are the posted questions getting worse?

    J Livingston SQL (9/27/2016)


    drew.allen (9/27/2016)


    Okay, is it just me? I've seen two different people post sample data where the datetime data is given in hex and converted to datetime....

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Multiple row data need to be convert as Coloumn

    You're strings/dates aren't quoted. You should always try to run your query before posting it on the Internet.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Applying multiple date filters in sql query

    Infock12 (9/28/2016)


    Hello all,

    You expert opinion is much appreciated.

    I am running a report that covers the last two fiscal years. I want all the data for the last two years. The...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Are the posted questions getting worse?

    Okay, is it just me? I've seen two different people post sample data where the datetime data is given in hex and converted to datetime. It's not like...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Select continual date ranges from a list that overlaps

    Ken McKelvey (9/27/2016)


    One way is to expand the dates with a number/tally table and then roll them up again:

    The problem with this approach is that it can be very expensive,...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: while and if condition within a case statement t-sql

    dimpythewimpy (9/27/2016)


    Also, the reason I was unable to window function from the link above is, it does this:

    SUM(Col2) OVER(ORDER BY Col1 ROWS UNBOUNDED PRECEDING) "Rows" FROM #TMP

    basically...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Update Rows across tables sequentially

    rishakin (9/26/2016)


    Hi,

    Problem Statement:

    I have 2 tables say Table1 and Table2. They both have fields Number and type. But the numbers across the table should be reordered sequential when user clicks...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Select Max Value of a Summed Column With Priority Assignments

    ZZartin (9/27/2016)


    WITH TEMP_CTE AS(

    SELECT NameFrequency.Name, NameFrequency.Role, RoleRankLookup.Priority, SUM(NameFrequency.Count) AS TOTAL, RANK() OVER(PARTITION BY NameFrequency.Name ORDER BY SUM(NameFrequency.Count) DESC, RoleRankLookup.Priority ASC) AS RN

    FROM (VALUES('Jack', 'Student', 3),

    ('Jack', 'Teacher', 5),

    ('Jack', 'Admin', 2),

    ('Jack', 'Student',...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: while and if condition within a case statement t-sql

    Jacob Wilkins (9/27/2016)


    The Dixie Flatline (9/26/2016)


    you should specify the window frame (generally ROWS UNBOUNDED PRECEDING), because the default is RANGE UNBOUNDED PRECEDING, and which is much slower than specifying...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Any way to clean up mutually exclusive OR conditions?

    Luis Cazares (9/26/2016)


    I can't picture a situation in which a CASE statement could be the only option in a WHERE clause.

    I, however, can see a lack of understanding of SQL....

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: while and if condition within a case statement t-sql

    pietlinden (9/26/2016)


    If the reason for your loop is to implement a running total, why not just use a Window function and do something like

    SUM( <column to be summed> )...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: while and if condition within a case statement t-sql

    dimpythewimpy (9/26/2016)


    I am trying to implement a while loop and if condition (with a function call) in a case statement. Basically, I am trying to do this:

    begin

    case

    when (condition1 and condition...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Any way to clean up mutually exclusive OR conditions?

    Luis Cazares (9/26/2016)


    drew.allen (9/26/2016)


    xr280xr (9/26/2016)


    I don't specifically care about short circuiting. I just need to only evaluate b if a is false and only evaluate c if a and b...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 2,326 through 2,340 (of 4,085 total)