Click here to Skip to main content
15,889,096 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
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()
Posted

1 solution

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[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900