Collapse Logic in SQL

  • Source

    ABC 01/10/2010 01/10/2011

    ABC 01/10/2011 01/01/2012

    ABC 01/10/2012 01/01/9999

    BCD 01/10/2010 01/10/2011

    Bcd 01/20/2011 01/01/9999

    Target

    ABC 01/10/2010 01/01/9999

    BCD 01/10/2010 01/10/2011

    Bcd 01/20/2011 01/01/9999

    Show me the example in SQL

  • looks like GROUP BY , and getting the MIN and MAX values;

    what have you tried so far?

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Min and Max doesn work for the 2nd Example.

  • vp7986 (8/22/2012)


    Min and Max doesn work for the 2nd Example.

    Well, that's a collation issue. The default collation is case-insensitive, so BCD = bCd = BcD = Bcd... You can change the collation using the COLLATE keyword. Look it up.

    Jared
    CE - Microsoft

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply