# Component results passing to another component

**URL:** <https://matillioncommunity.discourse.group/t/component-results-passing-to-another-component/1809>\
**Category:** Matillion ETL\
**Created:** [July 14, 2022, 8:49pm UTC](https://matillioncommunity.discourse.group/t/component-results-passing-to-another-component/1809 "2022-07-14T20:49:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![santosh.b.biradar](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@santosh.b.biradar](https://matillioncommunity.discourse.group/u/santosh.b.biradar)\
**Post date:** [July 14, 2022, 8:49pm UTC](https://matillioncommunity.discourse.group/t/component-results-passing-to-another-component/1809/1 "2022-07-14T20:49:47Z")

</div>

Hi,

I'm still learning this tool and need some help on achiving this.

my source is snowflake and using component to get one column values and I need to pass this column values to next component which is DataBase Query. How can I do it?

Eample:

Source (Snowflake)

select col\_a \<-----

from table\_name

&nbsp;

To (DB query)

select count(\*)

from col\_a \<----

&nbsp;

&nbsp;

Thanks,

BS

&nbsp;

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![Michael](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@Michael](https://matillioncommunity.discourse.group/u/Michael)\
**Post date:** [July 25, 2022, 6:33am UTC](https://matillioncommunity.discourse.group/t/component-results-passing-to-another-component/1809/2 "2022-07-25T06:33:41Z")

</div>

You can try the following approach:

1. Creata a new job variable $myvar
2. Use "Query Result To Scalar" (https://documentation.matillion.com/docs/2978362) to load a value to $myvar
3. In the Database Query Component choose advanced mode and add $myvar to your query: select count(\*) from ${myvar}

---

<div class="post-metadata">

**Author:** ![santosh.b.biradar](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@santosh.b.biradar](https://matillioncommunity.discourse.group/u/santosh.b.biradar)\
**Post date:** [August 9, 2022, 6:28pm UTC](https://matillioncommunity.discourse.group/t/component-results-passing-to-another-component/1809/3 "2022-08-09T18:28:15Z")

</div>

Thanks Michael. This helps.

facing another issue. can you suggest what i'm doing wrong?

&nbsp;

I'm using the database query component to connect SAP hana and i'm doing just

select count(\*) from sap\_db\_name.${saptablename}

&nbsp;

${saptablename} = Is passed from scalar variable. I can see this variable showing correct values when i check SQL of database query component to make sure this variable is getting value or not.

&nbsp;

error

SQL compilation error: error line 1 at position 60

invalid identifier '"COUNT(\*)"'

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![Michael](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@Michael](https://matillioncommunity.discourse.group/u/Michael)\
**Post date:** [August 15, 2022, 5:57am UTC](https://matillioncommunity.discourse.group/t/component-results-passing-to-another-component/1809/4 "2022-08-15T05:57:16Z")

</div>

Hi [@santosh.b.biradar](https://matillioncommunity.discourse.group/u/santosh.b.biradar)​ ,

I am not familiar with SAP hana. If that query can be executed in your source database system and the SQL which is generated by Matillion is valid, then the Database Query Component should work. I think you should open a ticket with Matillion Support to investigate this further.
