Saturday, July 27, 2013

正義有罪?

挺身而出指責執法不公重要,定係扮假道學人士重要?答案十分明顯。

有無學生純情到以為老師在私人時間都唔會講粗口?如果有,係時候醒醒。

Tuesday, July 23, 2013

Force some rows to appear last in SQL

Everyone who writes SQL knows ORDER BY, which forces the result to be ordered by the values in the specified column. I had a scenario where I not only needed to ordered by the values in a column but also wanted a certain value to appear last. Naturally I go to Google first and as usual it found me what I needed from StackOverflow. See this post, which was about forcing rows to appear first. For my purpose I just needed to flip the 0 and 1 in the CASE-WHEN. BTW, if one still wants the results to be ordered by that column, simply add that column after the CASE-WHEN in ORDER BY.