SelectResult syntax


#1

Are the following two SelectResult statements ALWAYS the same?
a. SelectResult.property(“propertyName”)
b. SelectResult.expression(Expression.property(“propertyName”))
Please advise on preferable usage.

Likewise, Are the following two SelectResult statements the same?
c. SelectResult.property(“propertyName”).as(“alias”)
d. SelectResult.expression(Expression.property(“propertyName”).from(“alias”)
Please advise on preferable usage.

Thank you much,
-nat


#2

a. is just shorthand for b. Literally all it does it call b. for you to save some verbosity :slight_smile: .

c. and d. are not the same though. One is naming a variable for use with selecting it via string key in the query results, and one is for specifying which part of a JOINed query to pull the given property from (the main part, or the joined part(s)).

EDIT That is assuming you meant to use “as” vs “from” and that wasn’t a typo.


#3

Thank you much for the quick tutorial.
And yes, ‘as’ was NOT a typo. In fact, it’s the only optional call available there.

thanks again;
nat