我正在尝试列出,排序和分页父节点下的所有文件夹和文件。这是我的查询只选择文件夹,它给了我预期的结果:
SELECT childFolder.[jcr:name], childFolder.[jcr:uuid] FROM [nt:base] AS parent LEFT OUTER JOIN [nt:folder] AS childFolder ON ISCHILDNODE(childFolder, parent) WHERE parent.[jcr:uuid] = 'a54ca11b-99f8-42cf-8348-8c0f3bc4f008' ORDER BY parent.[jcr:primaryType] DESC
然后我为文件添加了另一个连接,但它没有返回任何结果:
LEFT OUTER JOIN [nt:file] AS childFile ON ISCHILDNODE(childFile, parent)
最终查询:
SELECT childFolder.[jcr:uuid] FROM [nt:base] AS parent LEFT OUTER JOIN [nt:folder] AS childFolder ON ISCHILDNODE(childFolder, parent) WHERE parent.[jcr:uuid] = 'a54ca11b-99f8-42cf-8348-8c0f3bc4f008' ORDER BY parent.[jcr:primaryType] DESC
1.有没有办法通过一个查询获取文件夹和文件? 2.在第一个查询中,我尝试获取[jcr:name],但它给了我null。如何获取节点的名称?
答案 0 :(得分:0)
这个人的工作:
SELECT [jcr:primaryType], [jcr:created], [jcr:createdBy], [jcr:path] FROM [nt:file]
UNION
SELECT [jcr:primaryType], [jcr:created], [jcr:createdBy], [jcr:path] FROM [nt:folder]