# How to obtain current user key from iUser table in SQL queries

**URL:** <https://www.five.org/t/how-to-obtain-current-user-key-from-iuser-table-in-sql-queries/232>\
**Category:** How do I?\
**Created:** [June 8, 2023, 3:44am UTC](https://www.five.org/t/how-to-obtain-current-user-key-from-iuser-table-in-sql-queries/232 "2023-06-08T03:44:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abu\_Bakr\_Siddique](https://yyz2.discourse-cdn.com/flex030/user_avatar/www.five.org/abu_bakr_siddique/32/172_2.png) [@Abu\_Bakr\_Siddique](https://www.five.org/u/Abu_Bakr_Siddique)\
**Post date:** [June 8, 2023, 3:44am UTC](https://www.five.org/t/how-to-obtain-current-user-key-from-iuser-table-in-sql-queries/232/1 "2023-06-08T03:44:16Z")

</div>

Hi,  
I am trying to use an SQL query to populate a Menu. I require the current logged-in user’s iUserKey from the iUser table. In JS I know it is something like five.currentUserKey() but how do I perform the same action in SQL?

---

<div class="post-metadata">

**Author:** ![mark](https://yyz2.discourse-cdn.com/flex030/user_avatar/www.five.org/mark/32/300_2.png) [@mark](https://www.five.org/u/mark)\
**Post date:** [June 8, 2023, 4:05am UTC](https://www.five.org/t/how-to-obtain-current-user-key-from-iuser-table-in-sql-queries/232/2 "2023-06-08T04:05:20Z")

</div>

Hi,

In SQL you use a parameter. In the actual SQL you use a ‘?’ where you want the parameter and then you define the parameter to the query. The parameter type needs to be expression and then you put ‘{{five.currentUserKey()}}’ as the parameter. The Parameter ID is only for documentation and doesn’t matter.

Hope this helps.

Mark
