Forum Replies Created

Viewing 15 posts - 3,631 through 3,645 (of 4,820 total)

  • RE: CTE (?) or query help

    Try this:

    WITH YT1 AS (

    SELECT YT.ID, YT.[Date], YT.Stat1

    FROM YourTable AS YT

    WHERE YT.Stat1 IS NOT NULL

    AND YT.[Date] = (SELECT MAX(Y.[Date]) FROM YourTable AS Y WHERE Y.ID = YT.ID)

    ),

    YT2 AS (

    SELECT YT.ID,...

  • RE: Help with Query - Counting item Occurrence over a rolling 72 hour period

    jparks 85798 (6/18/2015)


    Steve,

    Thanks for the follow up. I agree, the windowed functions are nice, but not quite as robust as I had hoped. As for the datetime...

  • RE: Help in making query for presenting data in different format

    sqlinterset (6/18/2015)


    I have below table:

    IF OBJECT_ID('tempdb..#complaints') IS NOt NULL

    DROP TABLe #complaints

    --===== Create the test table with

    create table #cs([Year] float,

    [Week] float,

    [Month] float,

    [C#] float,

    [Dept] nvarchar(255)

    ,[Issue]...

  • RE: Help with Query - Counting item Occurrence over a rolling 72 hour period

    jparks 85798 (6/18/2015)


    All,

    My first post here and i'm still relatively new to t-sql. I have searched around and I am completely stuck on where to even start. I am using...

  • RE: My understanding of left join is been proving wrong

    Let's try this:

    DECLARE @TA AS TABLE (Id int,CheckValue nvarchar(10),[Status] int)

    INSERT INTO @TA VALUES(123,'60',1)

    INSERT INTO @TA VALUES(123,'45',0)

    INSERT INTO @TA VALUES(123,'76',0)

    INSERT INTO @TA VALUES(123,'50',0)

    DECLARE @TB AS TABLE (Id int,OCheckValue nvarchar(10),CheckValue nvarchar(10),OValue int)

    INSERT...

  • RE: "Automatic" partitioning

    craig.g.smith (6/17/2015)


    A common partitioning scenario is when the partition column has the same value for every record in the partition, as opposed to a range of values. Am I...

  • RE: Find appointments within 7 days, excluding weekends.

    NineIron (6/17/2015)


    Thanx.

    What are you going to do about non-weekend holidays? At that point, just using 7 weekdays isn't going to keep it straight. There's really no good...

  • RE: Error converting data type varchar to numeric

    Lynn Pettis (6/17/2015)


    The problem is the commas in the string. Try this select statement:

    select CONVERT(NUMERIC(17,2),replace(@stg,',',''))

    Yes, it will get rid of the commas, but it seems odd that a comma...

  • RE: Combined Ranking

    bugg (6/18/2015)


    I am trying to get a ranking a cross certain columns , basically a weighting depending on criteria.

    Using the below code as an example this how far i have...

  • RE: How Do I Combined These Two Select Statements?

    A couple of additional notes:

    1.) Your LEFT OUTER JOINs are getting converted to INNER JOINs because of your WHERE clause seeking a NOT NULL value for the date from the...

  • RE: How Do I Combined These Two Select Statements?

    sqlnoob2015 (6/17/2015)


    I am having the hardest time combining these two select statements into one. Can anyone give me some advice on these?

    Thank you!!

    Basically i want my results...

  • RE: ODBC Error updating a recordset (rst.Update)

    jpserra3 (6/17/2015)


    Hi Steve, Hi Lowell, Thank you for responding.

    Steve, I can re-post this in the access forum, but I was not sure if this may be a permissions...

  • RE: ODBC Error updating a recordset (rst.Update)

    jpserra3 (6/15/2015)


    I am getting an error (number -2147217887, error message "ODBC--call failed.") when I try to execute an rst.Update. I have an MS Access 2013 application using an ODBC connection...

  • RE: Query assistance....

    idea01 (6/2/2015)


    Ozzmodiar (6/2/2015)


    I see you have a perfectly valid solution, so I won't bother typing it all up unless you're interested.

    There is a very elegant solution to this problem using...

  • RE: Concurrent Connection Trigger

    jayoub (6/16/2015)


    I am STIGing a database and have to create a trigger that will stop any

    connection from occurring after a certain limit has been reached. For

    example I set the...

Viewing 15 posts - 3,631 through 3,645 (of 4,820 total)