# Limiting return data to a power table with a select query

**URL:** <https://forum.inductiveautomation.com/t/limiting-return-data-to-a-power-table-with-a-select-query/15747>\
**Category:** Ignition\
**Created:** [October 22, 2017, 9:57pm UTC](https://forum.inductiveautomation.com/t/limiting-return-data-to-a-power-table-with-a-select-query/15747 "2017-10-22T21:57:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jshaffer09](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jshaffer09](https://forum.inductiveautomation.com/u/jshaffer09)\
**Post date:** [October 22, 2017, 9:57pm UTC](https://forum.inductiveautomation.com/t/limiting-return-data-to-a-power-table-with-a-select-query/15747/1 "2017-10-22T21:57:23Z")

</div>

This is the example. I get errors when I add the Limit 1000. Any Ideas  
SELECT \* FROM table Where equipment # =1 Order by Timestamp desc limit 1000

---

<div class="post-metadata">

**Author:** ![cmisztur2](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmisztur2/32/4243_2.png) [@cmisztur2](https://forum.inductiveautomation.com/u/cmisztur2)\
**Post date:** [October 22, 2017, 10:39pm UTC](https://forum.inductiveautomation.com/t/limiting-return-data-to-a-power-table-with-a-select-query/15747/2 "2017-10-22T22:39:06Z")

</div>

select top 1000 \* …

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 22, 2017, 10:48pm UTC](https://forum.inductiveautomation.com/t/limiting-return-data-to-a-power-table-with-a-select-query/15747/3 "2017-10-22T22:48:26Z")

</div>

The syntax varies among database types. For MySQL and PostgreSQL, the LIMIT clause is used at the end of the query. For MS SQLServer, the TOP clause is placed just after “SELECT”. For Oracle, you have to use a subquery and filter on rownum, if I recall correctly.

---

<div class="post-metadata">

**Author:** ![martinel3746](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@martinel3746](https://forum.inductiveautomation.com/u/martinel3746)\
**Post date:** [October 24, 2017, 3:22pm UTC](https://forum.inductiveautomation.com/t/limiting-return-data-to-a-power-table-with-a-select-query/15747/4 "2017-10-24T15:22:26Z")

</div>

for Oracle you can add it to the where clause:  
WHERE …  
…  
AND rownum \<= 1000

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 24, 2017, 3:38pm UTC](https://forum.inductiveautomation.com/t/limiting-return-data-to-a-power-table-with-a-select-query/15747/5 "2017-10-24T15:38:00Z")

</div>

> [@martinel3746](#):
>
> for Oracle you can add it to the where clause:WHERE ......AND rownum \<= 1000

Be _very_ careful with this -- the comparison is applied _ **before** _ the ORDER BY clause is evaluated. You might get no rows at all. See the [Oracle Docs on ROWNUM](https://docs.oracle.com/cd/B19306_01/server.102/b14200/pseudocolumns009.htm).

---

<div class="post-metadata">

**Author:** ![martinel3746](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@martinel3746](https://forum.inductiveautomation.com/u/martinel3746)\
**Post date:** [October 24, 2017, 6:40pm UTC](https://forum.inductiveautomation.com/t/limiting-return-data-to-a-power-table-with-a-select-query/15747/6 "2017-10-24T18:40:53Z")

</div>

True, as you stated before, use a sub-query to control the order of operations with Oracle.  
As a rule, I group and summarize things that are presented to the user so they don’t have to look through thousands of records; I sometimes forget that others use different ways to limit the volume of records displayed.
