这是我的SQL Querry如何使用XML访问此Querry [英] this my sql querry how to access this querry using xml

查看:78
本文介绍了这是我的SQL Querry如何使用XML访问此Querry的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2张桌子
SELECT [id]
,[问题]
,[qimage1]
,[qimage2]
,[qimage3]
,[状态]
来自[Driving_School].[dbo].[tab_eng_module]
GO

SELECT [module_id]
,[option1]
,[option2]
,[option3]
,[image1]
,[image2]
,[image3]
,[answer]
,[状态]
来自[Driving_School].[dbo].[tab_eng_module_details]
GO




这是我的sql查询器 如何使用xml访问此查询器



选择top(1)dbo.tab_eng_module.id,dbo.tab_eng_module.question,dbo.tab_eng_module.qimage1,dbo.tab_eng_module.qimage2,dbo.tab_eng_module.qimage3,dbo.tab_eng_module_details.option1,dbo.tab_eng_module .option3,dbo.tab_eng_module_details.image1,dbo.tab_eng_module_details.image2,dbo.tab_eng_module_details.image3,dbo.tab_eng_module_details.answer FROM dbo.tab_eng_module INNER dbo.tab_eng_module_details.image dbo.tab_eng_module_details.image = tab_eng_module_details.status = 1由newid()

i have 2 tables
SELECT [id]
,[question]
,[qimage1]
,[qimage2]
,[qimage3]
,[status]
FROM [Driving_School].[dbo].[tab_eng_module]
GO

SELECT [module_id]
,[option1]
,[option2]
,[option3]
,[image1]
,[image2]
,[image3]
,[answer]
,[status]
FROM [Driving_School].[dbo].[tab_eng_module_details]
GO




this my sql querry how to access this querry using xml



SELECT top(1) dbo.tab_eng_module.id, dbo.tab_eng_module.question, dbo.tab_eng_module.qimage1, dbo.tab_eng_module.qimage2, dbo.tab_eng_module.qimage3,dbo.tab_eng_module_details.option1, dbo.tab_eng_module_details.option2, dbo.tab_eng_module_details.option3,dbo.tab_eng_module_details.image1, dbo.tab_eng_module_details.image2, dbo.tab_eng_module_details.image3,dbo.tab_eng_module_details.answer FROM dbo.tab_eng_module INNER JOIN dbo.tab_eng_module_details ON dbo.tab_eng_module.id = dbo.tab_eng_module_details.module_id where dbo.tab_eng_module_details.status=1 order by newid()

推荐答案

SELECT top(1)dbo.tab_eng_module.id,dbo.tab_eng_module.question,dbo.tab_eng_module.qimage1, dbo.tab_eng_module.qimage2,
dbo.tab_eng_module.qimage3,dbo.tab_eng_module_details.option1,dbo.tab_eng_module_details.option2,dbo.tab_eng_module_details.option3,
dbo.tab_eng_module_details.image1,dbo.tab_eng_module_details.image2,dbo.tab_eng_module_details.image3,dbo.tab_eng_module_details.answer
来自dbo.tab_eng_module
内联接
dbo.tab_eng_module_details
开启dbo.tab_eng_module.id = dbo.tab_eng_module_details.module_id
其中
dbo.tab_eng_module_details.status = 1由newid()排序

对于XML Path(''Row''),root(''Module'')

试试吧,我认为它将对您有帮助

或检查此网站

http://msdn.microsoft.com/en-us/library/ms178107.aspx [ ^ ]
SELECT top(1) dbo.tab_eng_module.id, dbo.tab_eng_module.question, dbo.tab_eng_module.qimage1, dbo.tab_eng_module.qimage2,
dbo.tab_eng_module.qimage3,dbo.tab_eng_module_details.option1, dbo.tab_eng_module_details.option2, dbo.tab_eng_module_details.option3,
dbo.tab_eng_module_details.image1, dbo.tab_eng_module_details.image2, dbo.tab_eng_module_details.image3,dbo.tab_eng_module_details.answer
FROM dbo.tab_eng_module
INNER JOIN
dbo.tab_eng_module_details
ON dbo.tab_eng_module.id = dbo.tab_eng_module_details.module_id
where
dbo.tab_eng_module_details.status=1 order by newid()

For XML Path(''Row''),root(''Module'')

Try this i think it will help you

or check for this site

http://msdn.microsoft.com/en-us/library/ms178107.aspx[^]


这篇关于这是我的SQL Querry如何使用XML访问此Querry的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆