Forum Replies Created

Viewing 15 posts - 1,201 through 1,215 (of 1,464 total)

  • RE: SQL Query Help

    The reason that you are getting duplicates is because your source data is all the same. If you want to prevent duplicates in your results, then you need to find...

  • RE: Pivot Key-Value pairs

    This should do the trick


    CREATE TABLE #Company (CompanyID INT, CompanyName VARCHAR (100));
    CREATE TABLE #KVPairs (CompanyID INT, KeyColumn VARCHAR (100), ValueColumn VARCHAR (100));

    INSERT...

  • RE: t-sql 2012 insert into table without having duplicates

    You can try this


    INSERT INTO DCert (stateID, custnumber, lastname, firstname, mailAddress)
    WITH cteData AS (
    SELECT
      DC.[State Id] as stateID
    ,...

  • RE: Date Format issue

    arun@D - Thursday, April 6, 2017 1:28 PM

    DesNorton - Thursday, April 6, 2017 1:14 PM

  • RE: Date Format issue

    Does this give you the required output?


    -- This date is used so that SQL does not get an overflow error when calculating a large time...

  • RE: Running Total

    Joe Torre - Thursday, April 6, 2017 12:13 PM


    DROP TABLE IF EXISTS #mytable;
    GO
    CREATE TABLE #mytable (
      PartNum varchar(50),
      DueDate datetime,
      RequirementFlag tinyint,
     ...

  • RE: Running Total

    It seems you have an issue with duplicate records for PartNum, DueDate, Quantity).

    This should do the trick

    WITH cteBaseData AS (
    SELECT
      PartNum

  • RE: the time ofer to miss here to get

    Reported as spam

  • RE: Filtering data based on sum

    DesNorton - Wednesday, April 5, 2017 12:52 PM

    This sounds like a running totals issue.

    Something along the lines of .....
    SELECT as many random...

  • RE: Filtering data based on sum

    This sounds like a running totals issue.

    Something along the lines of .....
    SELECT as many random questions as needed
    WHERE QuestionType = 'Short Note'
    AND QuestionComplexity...

  • RE: Latest

    What about an option to MARK ALL AS READ.
    Then when looking at the UNREAD tab, we can start with fresh data.

  • RE: Removing Reverse Duplicates

    smw147 - Wednesday, April 5, 2017 10:32 AM

    Thanks for that, but it's not quite there.  I still wish to retain one of...

  • RE: Removing Reverse Duplicates

    To select the records without deleting the duplicates


    WITH cteBaseData AS (
    SELECT
      cr.ClientRef
      , cr.LinkedClientRef
      , rn = ROW_NUMBER() OVER (ORDER...

  • RE: Removing Reverse Duplicates

    This will remove the duplicates


    -- Create a table to hold the data
    CREATE TABLE #Links (
      ClientRef   INT
    , LinkedClientRef INT
    );

  • RE: get last two record on similar datas

    Your expected results do not match your supplied sample data.
    For this reason, I am unable to create a tested result.  However, the code below, should get ypu started.

Viewing 15 posts - 1,201 through 1,215 (of 1,464 total)