2014-01-09 59 views
1

我需要一個兔崽子SQL 2等效查詢此XPath查詢2等效查詢需要兔崽子SQL的XPath查詢

xpath = "/jcr:root//institutes/institute[*]/(@title | @overallScore)" 

我有這樣的地方SQL2 我可以用ISCHILDNODE得到'/IN/institues/institute'()約束

但我想以這種方式返回所有研究所'/%/institutes/institute'。如果我能實現這個使用連接,請讓我知道了聲明全文

Currenlty我使用此查詢,但沒有成功

裁判:reference link

sql2 = "SELECT institute.title, institute.overallScore FROM [nt:unstructured] AS country " 
      + "INNER JOIN [nt:unstructured] AS institutes ON ISCHILDNODE(institutes, country) " 
      + "INNER JOIN [nt:unstructured] AS institute ON ISCHILDNODE(institute, institutes) " 
      + "WHERE NAME(institutes) = 'institutes' ORDER BY institute.overallScore DESC"; 

我還發現,PATH()之類不兔崽子實施

回答

0

我沒有測試它自己,我不知道這是否是有效的,但此查詢應該工作:

select b.[jcr:path] as [jcr:path], 
     b.[title] as [title], 
     b.[overallScore] as [overallScore] 
from [nt:base] as a 
inner join [nt:base] as b on ischildnode(b, a) 
where name(a) = 'institutes' 
and name(b) = 'institute' 
+0

感謝它的工作!而且我還發現了另一個簡單的替代方法'select * from [nt:base],其中name()='institute''此查詢從存儲庫中獲取名稱爲institute的所有節點 – reverbnation