Peculiar Calculus

I met a problem on ordering a set of people by their job position, excepting someones with special credits. After some times of trial & error, I used a tricky technique named “Peculiar Calculus", that allows higher order person to be arranged in the more precedent place.

The problem was solved in SQL. The origin query was

Select * from some_table where some_criteria_fitted order by origin_orders;

and, supposing two guys named `a’ and `b’ respectively are peculiar men, the peculiar query is as

Select * from some_table where some_criteria_fitted order by name = ‘a’, name = ‘b’, origin_orders;

All right! It’s solved, and time is saved for enjoying my life.

廣告
本篇發表於 Strip。將永久鏈結加入書籤。

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com 標誌

您的留言將使用 WordPress.com 帳號。 登出 /  變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 /  變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 /  變更 )

Facebook照片

您的留言將使用 Facebook 帳號。 登出 /  變更 )

w

連結到 %s