Best SQL Server Tip Ever? - Community Credit Forums
in

    Community Credit Forums

Best SQL Server Tip Ever?

Last post Mon, Dec 8 2008 2:29 AM by DavidSilverlight. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • Mon, Dec 8 2008 2:29 AM

    Best SQL Server Tip Ever?

    In racking my brain about how to do a Select Distinct that is ordered by a field that is not in my resultset, I came across this very clever solution from Jeff Smith's Blog to avoid the error message below.  This solved literally hours of future head banging and I am going to remember this one for sure in the future. It is currently my favorite SQL Server tip of all time.

     Msg 145, Level 15, State 1, Line 4
    ORDER BY items must appear in the select list if SELECT DISTINCT is specified.

     

    Kindest regards,
      David Silverlight

    Follow me on Twitter: @HeadGeek
    Filed under:
Page 1 of 1 (1 items)
Powered by Community Server (Commercial Edition), by Telligent Systems