Select * from ....



  • I dont want to fuss about the select * in this query... But something else... Its a new and improved way to sort data...

     

    Check this out:

     

    <FONT color=#0000ff size=2>SELECT </FONT><FONT color=#ff0000 size=2>* </FONT><FONT color=#0000ff size=2>FROM XXX </FONT><FONT color=#0000ff size=2>ORDER BY </FONT><FONT size=2>TO_CHAR</FONT><FONT color=#ff0000 size=2>( (</FONT><FONT size=2>TO_DATE</FONT><FONT color=#ff0000 size=2>(</FONT><FONT size=2>DATUM</FONT><FONT color=#ff0000 size=2>,</FONT><FONT color=#008080 size=2>''</FONT><FONT size=2>dd</FONT><FONT color=#ff0000 size=2>.</FONT><FONT size=2>mm</FONT><FONT color=#ff0000 size=2>.</FONT><FONT size=2>yyyy</FONT><FONT color=#008080 size=2>''</FONT><FONT color=#ff0000 size=2>)),</FONT><FONT color=#008080 size=2>''</FONT><FONT size=2>yyyy</FONT><FONT color=#008080 size=2>''</FONT><FONT color=#ff0000 size=2>)</FONT><FONT color=#008080 size=2>'</FONT></FONT><FONT color=#008080 size=2>

    ||'</FONT><FONT color=#ff0000 size=2>||</FONT><FONT size=2>TO_CHAR</FONT><FONT color=#ff0000 size=2>( (</FONT><FONT size=2>TO_DATE</FONT><FONT color=#ff0000 size=2>(</FONT><FONT size=2>DATUM</FONT><FONT color=#ff0000 size=2>,</FONT><FONT color=#008080 size=2>''</FONT><FONT size=2>dd</FONT><FONT color=#ff0000 size=2>.</FONT><FONT size=2>mm</FONT><FONT color=#ff0000 size=2>.</FONT><FONT size=2>yyyy</FONT><FONT color=#008080 size=2>''</FONT><FONT color=#ff0000 size=2>)),</FONT><FONT color=#008080 size=2>''</FONT><FONT size=2>mm</FONT><FONT color=#008080 size=2>''</FONT><FONT color=#ff0000 size=2>)</FONT><FONT color=#008080 size=2>'

    ||'</FONT><FONT color=#ff0000 size=2>||</FONT><FONT size=2>TO_CHAR</FONT><FONT color=#ff0000 size=2>( (</FONT><FONT size=2>TO_DATE</FONT><FONT color=#ff0000 size=2>(</FONT><FONT size=2>DATUM</FONT><FONT color=#ff0000 size=2>,</FONT><FONT color=#008080 size=2>''</FONT><FONT size=2>dd</FONT><FONT color=#ff0000 size=2>.</FONT><FONT size=2>mm</FONT><FONT color=#ff0000 size=2>.</FONT><FONT size=2>yyyy</FONT><FONT color=#008080 size=2>''</FONT><FONT color=#ff0000 size=2>)),</FONT><FONT color=#008080 size=2>''</FONT><FONT size=2>dd</FONT><FONT color=#008080 size=2>''</FONT><FONT color=#ff0000 size=2>) </FONT><FONT color=#800080 size=2>DESC</FONT>

    <FONT color=#800080 size=2></FONT> 

    <FONT color=#800080 size=2>P.s.: DATUM is a string field...</FONT><FONT color=#008080 size=2>

    </FONT>


  • Hey, cut 'em some slack. TO_DATE is so hard to find documentation on!



  •  Surely I'm not the only one hoping you'll post the contents of the XXX database ...

    🙂



  • I wont be posting that... But Its not the only gem in it 😉

    Take a look here... BTW the Code is inside a FUNCTION that is called by "The Master" ( http://forums.thedailywtf.com/forums/p/7524/140090.aspx#140090 )

    Also if you noticed the "Odd" placement of double-' ... It is constructing a dynamic SQL String there



  • From the "things you already should know" file:

    This is fucking ludicrous!

    I'm really confused as to WTF the guy was thinking.



  • @belgariontheking said:

    I'm really confused as to WTF the guy was thinking.

    He was thinking "I can either waste 10 minutes looking for a better way or I could take 10 seconds to build this my way. The later is obviously better. Only a chump would waste time for nothing."


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.