Re: [xwiki-users] xwql join query
I tried the following query but I didn't get anything :( #set($fruits = $services.query.xwql(from doc.object(Fruit.FruitClass) as fru, doc.object(Supplier.SupplierClass) as sup where fru.Supplier.Name=sup.Name and sup.City='Melbourne').execute()) -- View this message in context: http://xwiki.475771.n2.nabble.com/xwql-join-query-tp5762763p5762809.html Sent from the XWiki- Users mailing list archive at Nabble.com. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] xwql join query
Hi Alina, On 11/22/2010 04:12 PM, afrey wrote: Hi all, I'm struggling creating a xwql query that joins two tables. Let's say I have two classes: Fruit and Supplier. Fruit has the following properties: Name, Supplier. What's the type of the Supplier property? Is it a database list? Have you tried using a string property instead (e.g. supplier name) and a join condition like fruit.Supplier = supplier.Name ? Hope this helps, Marius Supplier has the following properties: Name, City. I need the query that returns: All Fruit that has Supplier with City='Melbourne'. I can get all the Fruit objects: #set($fruits = $services.query.xwql(from doc.object(Fruit.FruitClass) as fru).execute()) And separately I can get all the Supplier objects that have city='Melbourne' #set($suppliers = $services.query.xwql(where doc.object(Supplier.SupplierClass).City='Melbourne').execute()) But I can't combine them. Please advise. Alina. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] xwql join query
Yes, sorry I forgot to mention. Supplier property is a Database List (it allows to select one Supplier from all of the Supplier objects created). Therefore I cannot have it set as string. It needs to be a selection from Supplier objects. Please check the previous post to see the join query that I tried. Alina. -- View this message in context: http://xwiki.475771.n2.nabble.com/xwql-join-query-tp5762763p5763031.html Sent from the XWiki- Users mailing list archive at Nabble.com. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] xwql join query
On 11/22/2010 04:27 PM, afrey wrote: I tried the following query but I didn't get anything :( #set($fruits = $services.query.xwql(from doc.object(Fruit.FruitClass) as fru, doc.object(Supplier.SupplierClass) as sup where fru.Supplier.Name=sup.Name and sup.City='Melbourne').execute()) On http://platform.xwiki.org/xwiki/bin/view/DevGuide/QueryGuide#HQueryLanguageExamples there is a query described as Search blogs per category. Blog category is a database tree but member of might work with database lists also. Can you try: #set($fruits = $services.query.xwql(from doc.object(Fruit.FruitClass) as fru, doc.object(Supplier.SupplierClass) as sup where sup member of fru.Supplier and sup.City='Melbourne').execute()) Hope this helps, Marius ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] xwql join query
I tried the query and it doesn't work. It seems that member of causes the query to fail to execute. Unfortunately I cannot use Database tree as the data type for Supplier property of Fruit. -- View this message in context: http://xwiki.475771.n2.nabble.com/xwql-join-query-tp5762763p5763517.html Sent from the XWiki- Users mailing list archive at Nabble.com. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Re: [xwiki-users] xwql join query
It doesn't have to be an xwql query. It could be sql, hql, anything that would work ;) -- View this message in context: http://xwiki.475771.n2.nabble.com/xwql-join-query-tp5762763p5763606.html Sent from the XWiki- Users mailing list archive at Nabble.com. ___ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users