摘要: select * from test where id in(3,1,5) order by find_in_set(id,'3,1,5');select * from test where id in(3,1,5) order by substring_index('3,1,2',id,1);SQL: select * from table where id IN (3,6,9,1,2,5,8,7);这样的情况取出来后,其实,id还是按1,2,3,4,5,6,7,8,9,排序的,但如果我们真要按IN里面的顺序排序怎么办?SQL能不能完成?是否需要取回来后再fo 阅读全文
posted @ 2013-03-27 23:14 不再犹豫、 阅读(381) 评论(0) 推荐(0) 编辑
摘要: 新浪有个面试题目:写一个php函数算出两个文件的相对路径 //计算出 c.php相对于e.php的相对路径应该是http://www.cnblogs.com/12/34$a = '/a/b/c/d/e.php'; $b = '/a/b/12/34/c.php'; getpathinfo($a, $b); function getpathinfo( $a, $b ) { $a2array = explode('/', $a); $b2array = explode('/', $b); $pathinfo = ''; 阅读全文
posted @ 2013-03-27 23:13 不再犹豫、 阅读(283) 评论(0) 推荐(0) 编辑