这个是我写的查询
SELECT DISTINCT questiontable.Title, questiontable.necessaryanswer, questiontype.topicName, optionstable.Scontent
FROM questiontable,optionstable,questiontype,questionnaire
where questiontable.questionID = optionstable.questionID and questiontable.topicID = questiontype.topicID and questiontable.papered=questionnaire.paperID
急求帮助!!!
把写好的查询语句贴我,附上说明,万分感谢
3 个解决方案
#1
想问问楼主所用的SQL版本!
#2
用的是05版的
#3
select distinct a.title,b.necessaryanswer,c.topicname,
(select scontent+',' from questionnaire where paperid = a.papered for xml path('')) as scontent
from questiontable a,optionstable b,questiontype c
where a.questionid = b.questionid
and a.topicid = b.topicid
试试!
#1
想问问楼主所用的SQL版本!
#2
用的是05版的
#3
select distinct a.title,b.necessaryanswer,c.topicname,
(select scontent+',' from questionnaire where paperid = a.papered for xml path('')) as scontent
from questiontable a,optionstable b,questiontype c
where a.questionid = b.questionid
and a.topicid = b.topicid
试试!