how can I converse SQL clause to XQuery clause??

the follow sql clause:
select A.unitid ,A.unitname from A where
unitid in (select unit from B)

besides:
A------>f:\xquery\unit.xml
B------>f:\xquery\taskplan.xml

I had conversed this sql to xqurey ,but return no values.who can help me?

my Xquery clause as following :
for $v1 in document (“F:\xquery\unit.xml”)//LSQLResults/Row
where some $v3 in $v1/unitid satisfies ( some $v4 in ( for $v2 in document(“F:\xquery\taskplan.xml”)//LSQLResults/Row return {$v2/unit} )//Row satisfies $v4=$v3)
return {$v1/unitid} {$v1/unitname}

Hi,

I do not fully understand what you intend, but I guess that the subexpression :
( for $v2 in document(“F:\xquery\taskplan.xml”)//LSQLResults/Row
return {$v2/unit} )
//Row
is empty.
The for clause retrieves Row element nodes. From each one of these you take the
set of unit element children and wrap these into a new Row element. From the set
of all these Row elements you select all Row descendants. Unless there are again
Row elements below unit this is an empty sequence.
Try to replace this subexpression with something better. I can advise you here
when you tell me what you intend.
Are you aware that case matters in XQuery, i.e. Row != row and unit != Unit ?

Regards,
Juliane.

thank you Juliane
my English capbility is poor,so you could not understand what I means.
sorry.

my problem had solved,by following expression:
for $v1 in document (“F:\xquery\unit.xml”)//LSQLResults/Row
where $v1/unitid =(for $v2 in document(“F:\xquery\taskplan.xml”)//LSQLResults/Row return {$v2/unit} )//unit
return {$v1/unitid} {$v1/unitname}

thx agin for your answer.
can we make friends,and help me learn English?

hi
how can I transfer this sql to XQuery clause?
select A.unitid ,A.unitname from A,B where A.unitid=B.unit group by A.unitid,A.unitname

Hi,

XQuery allows grouping by suitably combining other syntactic means
as described in an appendix to the recent XQuery draft, see

http://www.w3.org/TR/xquery/#id-grouping.

Be aware that the grammar has changed since QuiP was built and thus
some bits might look different, e.g. the order clause.

Regards,
Juliane.

PS: Your English will improve by taking part in forum discussions.

hi Juliane
thanks
I have saw the recent XQuery draft,
the change is obvious,and the function is stronger than ever.
now i am using Quip to develop a software

i need the recent Quip to support the recent XQuery draft,please give me the url
thanks,could you understand what i mean?

Hi,

yes I understood. There is no recent QuiP. For an up-to-date, free
XQuery implementation try saxon at http://saxon.sourceforge.net/.
For an overview visit the W3C’s XML Query site and go to
’products’.

Regards,
Juliane.

Forgot to mention that the W3C’s XML Query site is at
http://www.w3.org/XML/Query