# Passing multiple parameters to a KDB query

**URL:** <https://forum.kx.com/t/passing-multiple-parameters-to-a-kdb-query/11281>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [October 5, 2016, 6:27am UTC](https://forum.kx.com/t/passing-multiple-parameters-to-a-kdb-query/11281 "2016-10-05T06:27:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![john\_Anderson](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@john\_Anderson](https://forum.kx.com/u/john_Anderson)\
**Post date:** [October 5, 2016, 6:27am UTC](https://forum.kx.com/t/passing-multiple-parameters-to-a-kdb-query/11281/1 "2016-10-05T06:27:00Z")

</div>

Hi All,

My apologies for asking basic question.I am new to KDB. Can someone please let me know how i can pass two parameters to a KDB query. I am reading QForMortals, but this is not mentioned there.

```
maxpx:{[t;range] select max px from t where date within range}

here how i can pass both t and range to maxpx.Could you please explain with an example?

Thanks,

```

---

<div class="post-metadata">

**Author:** ![AquaQMatt](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@AquaQMatt](https://forum.kx.com/u/AquaQMatt)\
**Post date:** [October 5, 2016, 8:52am UTC](https://forum.kx.com/t/passing-multiple-parameters-to-a-kdb-query/11281/2 "2016-10-05T08:52:00Z")

</div>

Hi John,

When calling a function with multiple parameters, you should separate them with a semi colon, as shown below.

q)testquery:{[a;b] c:a + b; :c}

q)sumvalue:testquery\*\*[100;50]\*\*

q)sumvalue

150

In your case, something like:

```
maxpx[tablename;2016.05.06 2016.05.09]<font face='"arial,' sans-serif>Regards,

```

Matt

---

<div class="post-metadata">

**Author:** ![sohagan](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@sohagan](https://forum.kx.com/u/sohagan)\
**Post date:** [October 5, 2016, 12:59pm UTC](https://forum.kx.com/t/passing-multiple-parameters-to-a-kdb-query/11281/3 "2016-10-05T12:59:00Z")

</div>

Welcome John - I know Matt has answered your question, but for you to read after the example…this is in QForMortalshttp://code.kx.com/wiki/JB:QforMortals2/functions#Function\_Specificationspecifically sections 1.2.1 -\> 1.2.3Thanks\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_From: [personal-kdbplus@googlegroups.com](mailto:personal-kdbplus@googlegroups.com) [personal-kdbplus@googlegroups.com] on behalf of john Anderson [john.ags1984@gmail.com]Sent: 05 October 2016 06:27To: Kdb+ Personal DevelopersSubject: [personal kdb+] Passing multiple parameters to a KDB queryHi All,My apologies for asking basic question.I am new to KDB. Can someone please let me know how i can pass two parameters to a KDB query. I am reading QForMortals, but this is not mentioned there.maxpx:{[t;range] select max px from t where date within range}here how i can pass both t and range to maxpx.Could you please explain with an example?Thanks,-- Submitted via Google Groups

---

<div class="post-metadata">

**Author:** ![john\_Anderson](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@john\_Anderson](https://forum.kx.com/u/john_Anderson)\
**Post date:** [October 5, 2016, 6:50pm UTC](https://forum.kx.com/t/passing-multiple-parameters-to-a-kdb-query/11281/4 "2016-10-05T18:50:00Z")

</div>

Thanks Matt and Sean
