In the VehicleHistoryGraph db that I have, the mileage field is null for all the Automobile records - so that specific example won't work the way you want. If, say, you wanted to query for the VINs of all Automobiles whose Models provide the top 5 best cityMPG values (and return the VIN, cityMPG, and model name), this seems to provide the correct results: select in(isModel).VIN as VIN, cityMPG, name as modelName from (select from Model where in(isModel).size() > 0 order by cityMPG desc) limit 5
Breaking this down: - Get the Models for which Automobiles exist in the db - Order those Models by cityMPG - For each of the ordered Models: select the VINs for all Automobile records that reference the Model (using the isModel edge), cityMPG, and model name fields to construct the result records - Limit the result set to 5 records Hopefully this helps get you on the right track. On Tuesday, December 9, 2014 8:26:46 AM UTC-5, J Rhines wrote: > > I get a collection of nulls. > > In standard SQL, I would use a query something like the following... > > SELECT a.mileage, m.* > FROM Automobile AS a, Model AS m > WHERE a.model_id = m.id > ORDER BY a.mileage desc > LIMIT 10 > > Can I not do this in OrientDB? > > > On Tuesday, December 9, 2014 1:56:06 AM UTC-6, Curtis Mosters wrote: >> >> What happens if you try >> >> select out.mileage >> or >> select in.mileage >> >> Am Montag, 8. Dezember 2014 18:55:39 UTC+1 schrieb J Rhines: >>> >>> Hello, >>> >>> I've just started getting familiar with OrientDB (2.0M3). First off, the >>> installation and deployment went smoother than I hoped, the Studio makes >>> things very easy to use, and I look forward to developing against the >>> engine. That said, I have some trouble wrapping my head around how to do >>> some simple things. For example, in the VehicleHistoryGraph database, if I >>> wanted to see the Model of car along with the mileage for the longest >>> lasting car, what would that query look like? Trying "select mileage, >>> expand(out()) from Automobile" gave me the Model object, but without the >>> mileage. >>> >>> Thanks for any advice, >>> >>> Jeff >>> >> -- --- 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.
