# Example for Subquery; additional property for Movie DB

**URL:** <https://community.neo4j.com/t/example-for-subquery-additional-property-for-movie-db/32140>\
**Category:** Documentation\
**Created:** [January 16, 2021, 12:52am UTC](https://community.neo4j.com/t/example-for-subquery-additional-property-for-movie-db/32140 "2021-01-16T00:52:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![clem](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/clem/32/4364_2.png) [@clem](https://community.neo4j.com/u/clem)\
**Post date:** [January 16, 2021, 12:52am UTC](https://community.neo4j.com/t/example-for-subquery-additional-property-for-movie-db/32140/1 "2021-01-16T00:52:22Z")

</div>

I have a couple of suggestions to improve the documentation.

1. Add some interesting numeric fields to the Movie DB, such as Cost and BoxOffice.

2. I figured out an interesting example using SubQuery. Cost of a movie is many digits and varies a lot, so it's a bit hard to look at without formatting. But if you format the Cost as a string, then it won't sort numerically. With Subqueries, you can do a sort of the Cost as Numeric and in the subsequent query, drop the Numeric column (which is ugly but accurate.)

```auto
CALL{
   MATCH (m:Movie)
   WITH m.title AS Title,
         m.cost AS CostNumber, // cost as numeric so we can sort
         apoc.number.format(m.cost, '$#,###') AS Cost // as a formatted string
         RETURN title, Cost, CostNumber ORDER BY CostNumber DESC // ordered by Numeric
}
RETURN Title, Cost limit 100 // CostNumber is dropped

```

---

<div class="post-metadata">

**Author:** ![michael.hunger](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/michael.hunger/32/27377_2.png) [@michael.hunger](https://community.neo4j.com/u/michael.hunger)\
**Post date:** [January 23, 2021, 2:02pm UTC](https://community.neo4j.com/t/example-for-subquery-additional-property-for-movie-db/32140/2 "2021-01-23T14:02:10Z")

</div>

You don't need a subquery for that

ORDER BY can sort by any fields that are visible to the clause

```
 MATCH (m:Movie)
 RETURN m.title AS Title,
     apoc.number.format(m.cost, '$#,###') AS Cost // as a formatted string
 ORDER BY m.cost DESC
```
