# Is there any way to use 'nested queries' in Discover or Views?

**URL:** https://discuss.elastic.co/t/is-there-any-way-to-use-nested-queries-in-discover-or-views/147457
**Category:** Kibana
**Created:** [September 5, 2018, 6:07pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-use-nested-queries-in-discover-or-views/147457 "2018-09-05T18:07:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Gosforth](https://avatars.discourse-cdn.com/v4/letter/g/f08c70/32.png) [@Gosforth](https://discuss.elastic.co/u/Gosforth)
#### Post date: [September 5, 2018, 6:07pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-use-nested-queries-in-discover-or-views/147457/1 "2018-09-05T18:07:01Z")

</div>

I'm searching the way how can I use Kibana to show which clients where buying -2 months ago but not -1month ago. Something that would have running two SQL queries:

SELECT count(\*) FROM clients WHERE date BETWEEN '2018-07-01' AND '2018-07-31'

SELECT count(\*) FROM clients WHERE client\_id NOT IN (SELECT client\_id FROM clients WHERE date BETWEEN '2018-08-01' AND '2018-08-31') AND date BETWEEN '2018-07-01' AND '2018-07-31'

Best if I could have pie chart or similar... maybe Timelion... But even Discover pane would be good to have raw data.

Possible to do this in Kibana?  
Regards

---

<div class="post-metadata">

### Author: ![Nathan\_Reese](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_reese/32/84829_2.png) [@Nathan\_Reese](https://discuss.elastic.co/u/Nathan_Reese)
#### Post date: [September 5, 2018, 6:54pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-use-nested-queries-in-discover-or-views/147457/2 "2018-09-05T18:54:31Z")

</div>

That is currently not possible. Could you please open a feature request? [https://github.com/elastic/kibana/issues/new?template=Feature\_request.md](https://github.com/elastic/kibana/issues/new?template=Feature_request.md)

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [October 3, 2018, 6:54pm UTC](https://discuss.elastic.co/t/is-there-any-way-to-use-nested-queries-in-discover-or-views/147457/3 "2018-10-03T18:54:37Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
