Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expanding Embeddedlist Columns in a Select SQL Query #368

Open
pa-emmanuel opened this issue Jun 16, 2020 · 1 comment
Open

Expanding Embeddedlist Columns in a Select SQL Query #368

pa-emmanuel opened this issue Jun 16, 2020 · 1 comment

Comments

@pa-emmanuel
Copy link

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

@luigidellaquila
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants