Click here to Skip to main content
15,915,078 members
Home / Discussions / Database
   

Database

 
GeneralRe: Notification services Pin
Giorgi Dalakishvili18-Feb-09 6:26
mentorGiorgi Dalakishvili18-Feb-09 6:26 
GeneralRe: Notification services Pin
Wendelius18-Feb-09 7:03
mentorWendelius18-Feb-09 7:03 
QuestionTrack DB changes Pin
J-Cop18-Feb-09 3:23
J-Cop18-Feb-09 3:23 
AnswerRe: Track DB changes Pin
Wendelius18-Feb-09 6:16
mentorWendelius18-Feb-09 6:16 
GeneralRe: Track DB changes [modified] Pin
J-Cop18-Feb-09 21:21
J-Cop18-Feb-09 21:21 
GeneralRe: Track DB changes Pin
Wendelius18-Feb-09 23:03
mentorWendelius18-Feb-09 23:03 
AnswerRe: Track DB changes Pin
David Mujica18-Feb-09 6:26
David Mujica18-Feb-09 6:26 
QuestionFOR XML EXPLICIT driving me nuts! Pin
J4amieC18-Feb-09 1:47
J4amieC18-Feb-09 1:47 
Ive done this so many times, I just cant seem to get my head around what's wrong!

I have a table with data which looks like this

Columns (in order): siteNo, cardSchemeCode, currencyCode, saleAmount, saleTotal, refundAmount, refundTotal

0000001	DEL	GBP	12	240.05	0	0.00
0000001	JCB	GBP	1	20.00	0	0.00
CU1000000001	DEL	GBP	10	166.51	0	0.00


I am trying to get Xml that looks like:

<Root>
  <Site siteNo="0000001">
    <Currency currencyCode="GBP">
  </Site>
  <Site siteNo="CU1000000001">
    <Currency currencyCode="GBP">
  </Site>
</Root>


Instead I get:

<Root>
  <Site siteNo="0000001" />
  <Site siteNo="CU1000000001">
    <Currency currencyCode="GBP" />
    <Currency currencyCode="GBP" />
  </Site>
</Root>


Here is my SQL:

SELECT 1 TAG,
	NULL Parent,
	Site.siteNo 'Site!1!siteNo',
	NULL 'Currency!2!currencyCode'		
FROM records [Site]
GROUP BY siteNo
UNION 
SELECT 2 TAG,
	1 Parent,
	Site.siteNo,
	Currency.currencyCode		
FROM records [Currency]
INNER JOIN records [Site]
	ON Currency.siteNo = Site.siteNo 
GROUP BY Site.siteNo, Currency.currencyCode
FOR XML EXPLICIT, ROOT('Root')	


Any help?
AnswerRe: FOR XML EXPLICIT driving me nuts! Pin
Wendelius18-Feb-09 5:56
mentorWendelius18-Feb-09 5:56 
QuestionSimultaneous access to SQL server... Pin
ashok_rgm18-Feb-09 0:07
ashok_rgm18-Feb-09 0:07 
AnswerRe: Simultaneous access to SQL server... Pin
Ashfield18-Feb-09 1:29
Ashfield18-Feb-09 1:29 
QuestionSQL Server Access Pin
Diving Flo17-Feb-09 23:37
Diving Flo17-Feb-09 23:37 
AnswerRe: SQL Server Access Pin
Wendelius18-Feb-09 6:24
mentorWendelius18-Feb-09 6:24 
GeneralRe: SQL Server Access [modified] Pin
Diving Flo18-Feb-09 20:32
Diving Flo18-Feb-09 20:32 
GeneralRe: SQL Server Access Pin
Wendelius19-Feb-09 8:13
mentorWendelius19-Feb-09 8:13 
GeneralRe: SQL Server Access Pin
Diving Flo24-Feb-09 20:21
Diving Flo24-Feb-09 20:21 
GeneralRe: SQL Server Access Pin
Wendelius25-Feb-09 7:15
mentorWendelius25-Feb-09 7:15 
QuestionBreak point in sqlserver Pin
venu65617-Feb-09 21:53
venu65617-Feb-09 21:53 
AnswerRe: Break point in sqlserver Pin
Wendelius17-Feb-09 23:23
mentorWendelius17-Feb-09 23:23 
QuestionImprove the speed of Function Pin
member2717-Feb-09 15:05
member2717-Feb-09 15:05 
AnswerRe: Improve the speed of Function Pin
PIEBALDconsult17-Feb-09 16:05
mvePIEBALDconsult17-Feb-09 16:05 
AnswerRe: Improve the speed of Function Pin
Mycroft Holmes17-Feb-09 16:05
professionalMycroft Holmes17-Feb-09 16:05 
GeneralRe: Improve the speed of Function Pin
member2718-Feb-09 3:41
member2718-Feb-09 3:41 
AnswerRe: Improve the speed of Function Pin
Wendelius17-Feb-09 17:57
mentorWendelius17-Feb-09 17:57 
Questionquery to get results from 4 tables Pin
icanmakeiteasy17-Feb-09 0:29
icanmakeiteasy17-Feb-09 0:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.