Expanding Embeddedlist Columns in a Select SQL Query
pa-emmanuel opened this issue · comments
I have a vertex that has embeddedlist columns that reference records in other vertices with the @rids. If I do a simple select, I can see the @rids for this embedded column and if I click on it and I can see the referenced record. How do I select the embedded values in an SQL? I tried expand() on the column and the only thing I see if still the @Rid.
Kindly see an example below. How do I display a contact and all embedded phones in one query?
Contact
Name ---- STRING
Description ---- STRING
Phone ---- EMBEDDEDLIST ----> @Rid of corresponding record in Phone vertex displayed
Phone
Home Phone ---- STRING
Office Phone. ---- STRING
Hi @pa-emmanuel
You have a few strategies for this. One is expand()
, not sure how you are using it, but it's supposed to work...
Try the following in DemoDB:
create class Foo;
create property Foo.theList LINKLIST;
insert into Foo set name = 'a', theList= [#45:0, #45:1];
select expand(theList) from Foo;
Another one is nested projections https://orientdb.com/docs/3.0.x/sql/SQL-Projections.html#nested-projections
With the same data as above:
select name, theList:{*} from Foo
I hope it helps
Thanks
Luigi