做个矩阵,其实就是个二维数组,关键是要从数据库里调些数据,sql语句不熟练,就边学边用,同步地记些笔记,方便查阅
关于distinct和order by 发了个帖子(第一次哦)
首帖:
用的是oracle的数据库
目的是想选出唯一的userid(原有重复值),并且按照filepos排序(原filepos是1,2,3.。。不重复的序号)
问题:以下语句都不能满足要求
1)select distinct userid from bbsfile where rootid=371841(不重复,但是没按顺序排)
2)select distinct userid,filepos from bbsfile where rootid=371841 order by filepos(按顺序排列,但是有重复)
3)select distinct userid from bbsfile where rootid=371841 order by filepos(语法出错)
就是想让出现重复值的一列按照没有重复值得一列排序
有一个简单的回复解决了问题
select userid from bbsfile where rootid