Forum Replies Created

Viewing 15 posts - 3,061 through 3,075 (of 4,085 total)

  • RE: UPDATE common table expression

    The problem is that the table you are updating is not referenced (directly) in your FROM clause, so it is updating every row in that table. You want to...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Compare one row with another in a Table !

    dwain.c (1/7/2013)


    Any solution posed with a CTE can always be done without the CTE by making the CTE into a derived table as Lynn has shown.

    That's not entirely true. ...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Avoiding cursor: Help with getting only first match after previous match

    The problem is that your desired results require that your TABLE1 be sorted in a specific order, but the data provided is insufficient to enforce that order. You have...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Information_Schema.Columns on All Database

    anthony.green (11/5/2012)


    The code is sound when looked at in the editior but due to it being a XML character it strips it out in the main view.

    If you remove the...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: CROSS APPLY

    Skanda (10/17/2012)


    CROSS APPLY (

    SELECT col = CASE WHEN MAX(col) = MIN(col) THEN MAX(col) ELSE NULL END

    )

    CROSS APPLY applies a "function" to each row of the (virtual) table. In...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Pivot a table

    Without seeing your query, it's impossible to tell what the best approach may be. The previous posts will certainly work, but it's entirely possible that your original query may...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Extracting Data from single table

    I think that a GROUP BY is much simpler and probably faster, too.

    With YOURTABLE (TICKET,STATUS)

    AS

    (

    SELECT 9543,1 UNION ALL

    SELECT 9543,5 UNION ALL

    SELECT 9543,5 UNION ALL

    SELECT 9544,1 UNION...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: How to join four tables using left outer join

    neellotus07 (10/8/2012)


    I am using this query to create crystal report but it is hanging my report while running.

    Pls tell me all joins are right or wrong or some updation required.

    If...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Error when creating a table

    You want help resolving an error, but haven't included the text of the error message. That's like going to the doctor and asking him to help you without telling...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Search for a string in multiple columns, then insert into temp table

    You already have a thread on this topic http://www.sqlservercentral.com/Forums/Topic1371464-392-1.aspx Please don't start a new one.

    The reason your old thread hasn't gotten any comments, is that you haven't provided the...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Get count depending on specific criteria

    Cadavre (10/12/2012)


    Here's a total guess for what you're after: -

    SELECT Branch, Year,

    SUM(CASE WHEN fail = 'true' THEN 1 ELSE 0 END),

    SUM(CASE WHEN fail = 'true' AND

    =...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Decimal to DateTime2 conversion SQL SERVER 2008 help

    Your query 2 is invalid, because an (INNER) JOIN requires an ON clause, which is missing from your query. I suspect that the problem is in that missing clause.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Static way to get last day of the month from the past quarter

    GSquared (9/20/2012)


    I use nested DateAdd and DateDiff functions to get last and first days of various time periods. For example, find the number of months (DateDiff) from 1 Jan...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Getting NULL output against the column : completion_status

    John Mitchell-245523 (8/24/2012)


    You need to handle all eventualities once and once only in your case expression - something like this:

    ...

    CASE WHEN Interval < 1 THEN 'X'

    WHEN Interval >= 1 AND...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: subquery

    It's simple enough to test. Why don't you try it and report back the results?

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 3,061 through 3,075 (of 4,085 total)