笨方法:select a.tablename,b.tablename,c.tablename,d.tablename from tablename a,tablename b,tablename c,tablename d where a.id=b.id and a.id=c.id and a.id=d.id;
select tabelename ,decode(tablename,'name',1,'class',2,0) from test order by 2
创建一个view 调整一下顺序
select a.tablename,b.tablename,c.tablename,d.tablename from (select tablename from (select tablename from test group by tablename) where tablename='class') a,(select tablename from (select tablename from test group by tablename) where tablename='grade') b,(select tablename from test group by tablename) where tablename='name') c,(select tablename from test group by tablename) where tablename='school') d
oh不,我是想得到一个特定的记录集,上文decode好像可以解决,多谢几位!
另外再请教!:由于程序限制,SQL语句必须只返回一个字段,上文 select tabelename ,decode(tablename,'name',1,'class',2,0) from test order by 2 中如何改写成只返回一个字段呢?多谢!
select tablename from text where tablename not in(放在最后的记录)union select tablename from text where tablename in(话在最后的记录)
to qqyb2000(狂热): 以前我试过union的,好像不行,他不是按照语句的顺序排序的。就用decode了,多谢各位!
调整一下顺序
select tabelename ,decode(tablename,'name',1,'class',2,0) from test order by 2
中如何改写成只返回一个字段呢?多谢!
以前我试过union的,好像不行,他不是按照语句的顺序排序的。就用decode了,多谢各位!