2 Questions on a simple SELECT query

Code taken from the example:
“The basics of TigerGraph’s graph query language, GSQL”

(but some names are a little different as they were imported from another example)

  1. This compiles and runs:
CREATE QUERY GetPersons(vertex<person> inputPerson) FOR GRAPH social { 
Start = {inputPerson};
Friends = SELECT t FROM Start:s-(friendship:e)-person:t;
PRINT Friends; 
}

But this one does not:

CREATE QUERY GetPersons(vertex<person> inputPerson) FOR GRAPH social { 
Start = {inputPerson};
Friends = SELECT t FROM Start:s-(friendship:e)-:t;
WHERE e.connect_day BETWEEN to_datetime("2015-07-01") AND to_datetime("2016-09-01")
AND t.gender == "male";
PRINT Friends; 
}

As far as I can see the syntax from the example is perfect yet there’s a problem with “WHERE” as shown in the screenshot below:
image

And this is a screenshot from the Youtube video I copied this from:

Can someone kindly point out where I’m going wrong?

  1. The first example has this line:

Friends = SELECT t FROM Start:s-(friendship:e)-person:t;

And the second example writes the same line like this:

Friends = SELECT t FROM Start:s-(friendship:e)-:t;

Question: why is “person” removed from the second line/example?

Thank you

You have an extra semicolon at the end of your FROM clause.

You should only have a semicolon at end the end of your entire statement.

Thank you Victor. :blush:

1 Like