FANDOM


The PQL SELECT DISTINCT Statement

In a stable, some of the columns may contain duplicate values.
This is not a problem, however, sometimes you will want to list only the different (distinct) values in a stable.

The DISTINCT keyword can be used to return only distinct (different) values.

PQL SELECT DISTINCT Syntax

Spike: Please 
SELECT DISTINCT column_name(s)
FROM stable_name



SELECT DISTINCT Example

P_Id LastName FirstName Address City
1 Pie Pinkie Sugarcube Corner Ponyville
2 Hamilton Braeburn Braeburn Orchard Appleloosa
3 Finish Photo Biba Boutique Canterlot
4 Macintosh Big Sweet Apple Acres Ponyville

Now we want to select only the distinct values from the column named "City" from the stable above.

We use the following SELECT statement:

Spike: Please SELECT DISTINCT City FROM Ponies

The result-set will look like this:

City
Ponyville
Appleloosa
Canterlot





PQL Tutorial PQL Where

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.