# Kibana SQL - How to do where clause for @timestamp?

**URL:** <https://discuss.elastic.co/t/kibana-sql-how-to-do-where-clause-for-timestamp/249651>\
**Category:** Kibana\
**Tags:** elastic-stack-sql\
**Created:** [September 23, 2020, 11:44am UTC](https://discuss.elastic.co/t/kibana-sql-how-to-do-where-clause-for-timestamp/249651 "2020-09-23T11:44:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kelk](https://avatars.discourse-cdn.com/v4/letter/k/13edae/32.png) [@kelk](https://discuss.elastic.co/u/kelk)\
**Post date:** [September 23, 2020, 11:44am UTC](https://discuss.elastic.co/t/kibana-sql-how-to-do-where-clause-for-timestamp/249651/1 "2020-09-23T11:44:25Z")

</div>

hi  
I'm able to successfully do the SQL , but if I need to compare to `@timestamp` it fails as it doesn't like `@` symbol

```auto
POST _sql?format=txt
{
 "query": """
SELECT * from mytable
WHERE @timestamp < TODAY - INTERVAL 1 DAYS
"""
}

```

the above works if I put

```auto
WHERE event.created < TODAY - INTERVAL 1 DAYS

```

so something related to `@` symbol

---

<div class="post-metadata">

**Author:** ![ylasri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ylasri/32/86120_2.png) [@ylasri](https://discuss.elastic.co/u/ylasri)\
**Post date:** [September 23, 2020, 12:11pm UTC](https://discuss.elastic.co/t/kibana-sql-how-to-do-where-clause-for-timestamp/249651/2 "2020-09-23T12:11:51Z")

</div>

```
POST _sql?format=txt
{
  "query": """
SELECT * from "my-events"
WHERE "@timestamp" < TODAY() - INTERVAL 1 DAYS
"""
}
```

---

<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 21, 2020, 12:12pm UTC](https://discuss.elastic.co/t/kibana-sql-how-to-do-where-clause-for-timestamp/249651/3 "2020-10-21T12:12:05Z")

</div>

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