Hi Scott,

I tried this and ran into a couple of things...

It looks like there must be a 'FROM' field in the first SELECT.  I'm not 
sure why this is since my take on the syntax for SELECT 
<https://orientdb.com/docs/2.2/SQL-Query.html> is that the FROM field is 
optional and decoupled from WHERE:

SELECT [ <Projections> ] [ FROM <Target> [ LET <Assignment>* ] ]
    [ WHERE <Condition>* ]
    [ GROUP BY <Field>* ]

That's ok, I just added a "FROM V".  This changes my query to this:

CREATE EDGE myEdge
FROM (SELECT Label1 as NodeLabel1, Label2 AS NodeLabel2 FROM V WHERE @RID = 
#361:0)
TO (SELECT FROM node WHERE Label1 = NodeLabel1 AND Label2 = NodeLabel2)

It still fails, and the error message isn't very helpful:

2017-04-20 15:31:43:909 SEVER Internal server error:
com.orientechnologies.orient.core.exception.OCommandExecutionException: No 
edge has been created because no target vertices
DB name="testbed-004.orientdb" [ONetworkProtocolHttpDb]


I thought I'd try out something with a LET block:

CREATE EDGE myEdge
FROM (SELECT FROM data LET $temp=(SELECT Label1,Label2 FROM data) WHERE @RID 
= #361:0)
TO (SELECT FROM node WHERE Label1 = $temp.Label1 AND Label2 = $temp.Label2)

But this just gives me the same error.

I'd think there should be a way to have that second SELECT match to fields 
in the records in first vertex, but the solution remains elusive for me.




On Thursday, April 20, 2017 at 3:22:39 AM UTC-6, scott molinari wrote:
>
> Can you use aliases?
>
> CREATE EDGE myEdge 
> FROM (SELECT Label1 AS NodeLabel1, Label2 AS NodeLabel2 WHERE @RID = #
> 25:0)
> TO (SELECT FROM NodeClass2 WHERE Label1 = NodeLabel1 AND Label2 = 
> NodeLabel2)
>
> It's just a wild guess and not tested.
>
> Scott
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to