Forum Replies Created

Viewing 15 posts - 496 through 510 (of 2,452 total)

  • RE: How to calculate YTD from Given From date ?

    Luis Cazares (7/26/2016)


    Just a small correction to J Livingston's query to avoid scanning the whole table.

    SELECT

    Custmer,

    location,

    SUM(CASE WHEN [Date]...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: How to calculate YTD from Given From date ?

    maybe?....though my YTD is different than yours ?!?

    SET DATEFORMAT DMY

    CREATE TABLE #yourtable(

    Custmer INTEGER NOT NULL

    ,Date ...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Table joins

    join Details to Names twice.....once for CEO. second for Manager

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Merge Statement using CTE

    fergfamster (7/21/2016)


    Thanks, I dont really want to post 15 files you guys need to review to get an answer. ill figure it out.

    seems you havent figured it out yet ..so...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Pivot without an aggregate?

    maybe ??

    WITH cte AS (

    SELECT NAME,

    VALUE,

    ROW_NUMBER() OVER(PARTITION BY NAME ORDER BY (SELECT NULL)) rn

    FROM...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Creating a DBA Oncall list to email to group.

    randy.moodispaugh (7/20/2016)


    Yes, I'm good with the DB Mail. I'm just playing through the different kinds of logic I would need to create an automated rotation of the DBA On...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Shift time interval combining from parent to child

    Muhanned Maayeh-445298 (7/19/2016)


    J Livingston SQL (7/19/2016)


    Nice solution 🙂 thank you I will have to try out with our different conditions but looks very promising

    If you have "different conditions" then why...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: T SQL Query to fetch top 3 distinct data by joining 2 tables

    amirtharaj.j (7/19/2016)


    Hi,

    I have 2 tables. Please see the attached screen shot for data. I need to join these 2 tables with

    schoolID and pick top 3 students of each school...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Shift time interval combining from parent to child

    Nice solution 🙂 thank you I will have to try out with our different conditions but looks very promising

    If you have "different conditions" then why did you not post them...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Shift time interval combining from parent to child

    maybe, as a start?

    WITH CTE AS(

    SELECT ShiftID, UserID, StartTime AS tm

    FROM Shifts

    UNION...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Cast/Convert to Date with RTrim

    JaybeeSQL (7/19/2016)


    J Livingston SQL (7/19/2016)


    maybe?

    DECLARE @f1 AS VARCHAR(100)= 'The Double Cross (01/Mar/13)';

    SELECT CAST(LEFT(RIGHT(RTRIM(@F1), 10), 9) AS DATE);

    No that just returns a single date, and one I (would) need to embed...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: Cast/Convert to Date with RTrim

    maybe?

    DECLARE @f1 AS VARCHAR(100)= 'The Double Cross (01/Mar/13)';

    SELECT CAST(LEFT(RIGHT(RTRIM(@F1), 10), 9) AS DATE);

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: T SQL Query to fetch top 3 distinct data by joining 2 tables

    please read this and then repost.

    https://spaghettidba.com/2015/04/24/how-to-post-a-t-sql-question-on-a-public-forum/

    and why have you got duplicate identical rows in the student table?

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: How to use a table value function that splits a string

    NineIron (7/14/2016)


    I read Jeff's article. Way over my head. My data is relatively small so, the fnSplitString function works pretty quick.

    why use something that is "prettty quick" when you can...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • RE: How to use a table value function that splits a string

    Ed Wagner (7/14/2016)


    Like Jeff said, there are a lot of those functions out there that are lacking in performance. I haven't tested the function you posted, but just knowing...

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

Viewing 15 posts - 496 through 510 (of 2,452 total)