# Select value from object(dynamic) within object(dynamic)

**URL:** <https://community.cratedb.com/t/select-value-from-object-dynamic-within-object-dynamic/775>\
**Category:** SQL\
**Created:** [August 11, 2021, 3:21pm UTC](https://community.cratedb.com/t/select-value-from-object-dynamic-within-object-dynamic/775 "2021-08-11T15:21:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rafluq](https://avatars.discourse-cdn.com/v4/letter/r/76d3ee/32.png) [@rafluq](https://community.cratedb.com/u/rafluq)\
**Post date:** [August 11, 2021, 3:21pm UTC](https://community.cratedb.com/t/select-value-from-object-dynamic-within-object-dynamic/775/1 "2021-08-11T15:21:59Z")

</div>

Hello! I have the following table (obtained through the “SHOW CREATE TABLE” SQL directive):

```auto
"doc"."etgeometry_msgs%2ftwist" (
   "entity_id" TEXT,
   "entity_type" TEXT,
   "time_index" TIMESTAMP WITH TIME ZONE,
   "fiware_servicepath" TEXT,
   " __original_ngsi_entity__" OBJECT(DYNAMIC),
   "angular" OBJECT(DYNAMIC) AS (
      "x" OBJECT(DYNAMIC) AS (
         "type" TEXT,
         "value" BIGINT
      ),
      "y" OBJECT(DYNAMIC) AS (
         "type" TEXT,
         "value" BIGINT
      ),
      "z" OBJECT(DYNAMIC) AS (
         "type" TEXT,
         "value" BIGINT
      )
   ),
   "linear" OBJECT(DYNAMIC) AS (
      "x" OBJECT(DYNAMIC) AS (
         "type" TEXT,
         "value" BIGINT
      ),
      "y" OBJECT(DYNAMIC) AS (
         "type" TEXT,
         "value" BIGINT
      ),
      "z" OBJECT(DYNAMIC) AS (
         "type" TEXT,
         "value" BIGINT
      )
   )
)

```

How could I get angular.x.value using “SELECT” directive from SQL?

I’m trying this query:

```auto
SELECT
  time_index AS "time",
  linear.x.value AS metric,
  linear.x.value
FROM "doc"."etgeometry_msgs%2ftwist"
WHERE
  $__timeFilter(time_index)
ORDER BY 1,2

```

But it does not work

---

<div class="post-metadata">

**Author:** ![proddata](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/proddata/32/1379_2.png) [@proddata](https://community.cratedb.com/u/proddata)\
**Post date:** [August 11, 2021, 10:00pm UTC](https://community.cratedb.com/t/select-value-from-object-dynamic-within-object-dynamic/775/2 "2021-08-11T22:00:24Z")

</div>

Hi @rafluq

Welcome to the CrateDB Community!

You have to use the bracket syntax to select on object properties. ie

```auto
SELECT
  time_index AS "time",
  linear['x']['value'] AS metric,
  linear['x']['value']
FROM "doc"."etgeometry_msgs%2ftwist"
WHERE
  $__timeFilter(time_index)
ORDER BY 1,2

```

also see [Selecting data — CrateDB: Reference](https://crate.io/docs/crate/reference/en/4.6/general/dql/selects.html#objects)

---

<div class="post-metadata">

**Author:** ![rafluq](https://avatars.discourse-cdn.com/v4/letter/r/76d3ee/32.png) [@rafluq](https://community.cratedb.com/u/rafluq)\
**Post date:** [August 12, 2021, 7:23am UTC](https://community.cratedb.com/t/select-value-from-object-dynamic-within-object-dynamic/775/3 "2021-08-12T07:23:25Z")

</div>

Thank you very much for your answer!
