不知这样是否是楼主的意思? select t.QN, t.ON from ( Select Question.QuestionName QN, Option.OptionName ON, rownum as rn from Question a, Option b where a.QuestionID = b.QuestionID and a.QuestionID=1 ) t where t.rn = 1
这样的结果是不可能的 只能是这样子QN ON q1 25,28,32,95,85 或者 QN ON q1 25,28,32,95,85
建议楼主使用这个函数吧 结果更加直观 select t.QN wmsys.wm_concat(t.ON) as ON from ( Select Question.QuestionName QN, Option.OptionName ON from Question a, Option b where a.QuestionID = b.QuestionID and a.QuestionID=1 ) t group by t.QN;
楼主可以将讲结果传到 jsp页面的表格中然后 合并表格中的单元格 不就行了么?
select decode(rn,1,QN, null) QN t.ON from ( Select Question.QuestionName QN, Option.OptionName ON, rownum as rn from Question a, Option b where a.QuestionID = b.QuestionID and a.QuestionID=1 ) t where 这样的吧
select decode(rn,1,QN,null) QN,t.ON from ( Select Question.QuestionName QN, Option.OptionName ON, rownum as rn from Question a, Option b where a.QuestionID = b.QuestionID and a.QuestionID=1 ) t 回得太急了,修正下
select decode(rn,1,QN,null) QN,t.ON from ( Select Question.QuestionName QN, Option.OptionName ON, rownum as rn from Question a, Option b where a.QuestionID = b.QuestionID and a.QuestionID=1 ) t QN ON -- -- q1 25 28 32 95 85 这不就是你要的答案么!!不过这种排版问题都是放到应用程序里面来处理的
多条数据的话也可以用SQL达到目的 不过要修改代码改用分析函数了select decode(rn,1,QN,null) QN,t.ON from ( Select Question.QuestionName QN, Option.OptionName ON, number()over(order by Question.QuestionName parttion by Question.QuestionName) as rn from Question a, Option b where a.QuestionID = b.QuestionID ) t
QN ON
q1 25
28
32
95
85
t.ON
from
(
Select Question.QuestionName QN,
Option.OptionName ON,
rownum as rn
from Question a,
Option b
where a.QuestionID = b.QuestionID
and a.QuestionID=1
) t
where t.rn = 1
这样的结果是不可能的
只能是这样子QN ON
q1 25,28,32,95,85
或者
QN ON
q1 25,28,32,95,85
结果更加直观 select t.QN
wmsys.wm_concat(t.ON) as ON
from
(
Select Question.QuestionName QN,
Option.OptionName ON
from Question a,
Option b
where a.QuestionID = b.QuestionID
and a.QuestionID=1
) t
group by t.QN;
select decode(rn,1,QN,
null) QN
t.ON
from
(
Select Question.QuestionName QN,
Option.OptionName ON,
rownum as rn
from Question a,
Option b
where a.QuestionID = b.QuestionID
and a.QuestionID=1
) t
where
这样的吧
select decode(rn,1,QN,null) QN,t.ON
from
(
Select Question.QuestionName QN,
Option.OptionName ON,
rownum as rn
from Question a,
Option b
where a.QuestionID = b.QuestionID
and a.QuestionID=1
) t 回得太急了,修正下
<head>
<title>llll</title>
</head>
<body> <div id="aa"></div>
<h3>请输入要输入的表格的列数和行数:</h3>
行:<input type=text name="text1">
<br>
列:<input type=text name="text2">
<input type="button" value="提交" onclick="createtable()"> <h3>请输入两个数字</h3>
<h3>合并单元格:</h3>
从<input type=text name="text3">行 <input type=text name="text4">列开始
<br>
合并<input type=text name="text5">行 <input type=text name="text6">列
<br>
<input type="button" value="合并" onclick="changetable()">
<script>
var i,j,tmp,l,r;
function createtable()
{
tmp="<table border=1 width=5% id = aaa>"
l=document.all.text1.value;
r=document.all.text2.value; for(j=0;j<l;j++)
{
tmp=tmp+"<tr>"
for(i=0;i<r;i++)
{ tmp=tmp+"<td>"
tmp=tmp+"USE"
tmp=tmp+"</td>" }
tmp=tmp+"</tr>"
}
tmp=tmp+"</table>"
aa.innerHTML=tmp } function changetable(){
var tab = document.all.aaa;
if(tab){
l=document.all.text3.value;
r=document.all.text4.value;
var obj = document.all.aaa.childNodes(0).childNodes(l-1).childNodes(r-1);
row=document.all.text5.value;
col=document.all.text6.value;
with(obj){
colSpan = col;
rowSpan = row;
}
var tbody = document.all.aaa.childNodes(0);
if(col>1){
obj.nextSibling.removeNode();
}
for (var m = 0; m <row-1 ; m++)
{
for (var n = 0; n < col; n++ )
{
indexRow = eval(m+"+"+l);
indexCol = eval(n+"+"+r+"-"+"1");
tbody.childNodes(indexRow).childNodes(indexCol).removeNode();
}
}
}else{
alert("no table");
}
}</script>
</body>
</html>
select decode(rn,1,QN,null) QN,t.ON
from
(
Select Question.QuestionName QN,
Option.OptionName ON,
rownum as rn
from Question a,
Option b
where a.QuestionID = b.QuestionID
and a.QuestionID=1
) t QN ON
-- --
q1 25
28
32
95
85
这不就是你要的答案么!!不过这种排版问题都是放到应用程序里面来处理的
QN ON
q1 25
28
32
95
85
q2 12
35
14
78
34
不过要修改代码改用分析函数了select decode(rn,1,QN,null) QN,t.ON
from
(
Select Question.QuestionName QN,
Option.OptionName ON,
number()over(order by Question.QuestionName parttion by Question.QuestionName) as rn
from Question a,
Option b
where a.QuestionID = b.QuestionID
) t