FANDOM



The PQL FIRST() Function

The FIRST() function returns the first value of the selected column.

PQL FIRST() Syntax

Spike: Please 
SELECT FIRST(column_name) 
FROM stable_name



PQL FIRST() Example

We have the following "Orders" stable:

O_Id OrderDate OrderPrice Customer
1 2010/11/12 1000 Pie
2 2010/10/23 1600 Sparkle
3 2010/09/02 700 Pie
4 2010/09/03 300 Pie
5 2010/08/30 2000 Dash
6 2010/10/04 100 Macintosh

Now we want to find the first value of the "OrderPrice" column.

We use the following PQL statement:

Spike: Please SELECT FIRST(OrderPrice) AS FirstOrderPrice FROM Orders


Tip: Workaround if FIRST() function is not supported:

Spike: Please SELECT OrderPrice FROM Orders ORDER BY O_Id LIMIT 1

The result-set will look like this:

FirstOrderPrice
1000





PQL count() PQL last()

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.