query for sorting startdatetime and enddatetime

  • So the rest of the columns should be taken from the row with the max end date?

    p.s. You either haven't read that article or are ignoring it... I can't test a solution without test data, and I'm not converting from an image to a set of insert statements

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • yes that's right.... and I didn't put a test data because as you can see from the image it would be inappropriate to insert such a large data on a way that was explained in that article.

  • californication2704 (8/22/2011)


    yes that's right.... and I didn't put a test data because as you can see from the image it would be inappropriate to insert such a large data on a way that was explained in that article.

    Actually that isn't much data (25-30 rows?). Put yourself in Gail's shoes. Would you want to type up a bunch of inserts based on the image you posted? If you were paying standard consultant rates then sure...but for free help on the internet...it just isn't going to happen. You have one the best people on these boards trying to spoon feed you the content to post so she can help you. You have to help her help you. The query you are asking is actually pretty simple but there has been so much back and forth with her asking for the basis of being able to help that I suspect she probably gave up by now.

    The advantage of posting sample data is that the people who are volunteering their time to help you can spend their time working on the solution to your problem instead of spending time to setup the data.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • sorry for everything what I've done wrong for posting my prob.. I finally have find a solution for my prob...

    so thnx again for your efforts....

  • Common courtesy suggests that you would show your solution.

    I haven't given you an answer because your create table threw errors and the query you gave also threw errors (columns not existing in the table)

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 5 posts - 16 through 20 (of 20 total)

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