eddyhendricks2
New Member
I am very new to XQuery and doing some practise questions.Here's the XML :\[code\]<Bars> <Bar name="xyz"> <Beer name="Corona" cost="5" /> <Beer name="Coors" cost="4" /> </Bar> ... and so on\[/code\]I want to get names of all the pairs of bars that sell the same beers and the same price.Here's my attempt so far:\[code\]for $bar1 in doc("bar.xml")/Barsfor $bar2 in doc("bar.xml")/Barswhere $bar1/Bar/data(@name) < $bar2/Bar/data(@name)for $beers1 in $bar1/Bar/Beerfor $beers2 in $bar2/Bar/Beer\[/code\]Here is where I try matching the beer names and the prices, but the answer is no where close. I feel I will need two joins but I'm not sure. Any hints in the right direction would be greatly appreciated.Thank you.