This article provides information regarding the SQL syntax and the use of the DISTINCT criteria in PS Query.
Detailed information
- PeopleSoft® Query will automatically generate SQL based on how you design your query.
- When you go to the "View SQL" tab, you can see the SQL code.
- You cannot modify the SQL from this page.

Back to top
PeopleSoft® utilizes a subset of SQL standard functions. Simply, SQL is a set of instructions listing the SELECT on of specific fields, FROM specific tables WHERE certain circumstances exist.
- SELECT: lists fields or column names used in the query
- FROM: lists tables or records used in the query
- WHERE: lists filters to include or exclude data

Back to top
When you wish to have a row of data appear only once—even though it may meet the criteria more than once—use the DISTINCT criteria. Distinct removes duplicate rows of output from the results.
Suppose you want a query that does not show every prospect, but you're interested in the last school attended for each career.
Without Distinct
Career
|
Last School Attended
|
GRAD
|
|
GRAD
|
000000001
|
UGRD
|
000000001
|
UGRD
|
000000001
|
UGRD
|
000000001
|
UGRD
|
000000001
|
UGRD
|
000000001
|
UGRD
|
000000001
|
UGRD
|
|
GRAD
|
000000001
|
UGRD
|
000000001
|
UGRD
|
000010009
|
UGRD
|
000010005
|
UGRD
|
000010008
|
UGRD
|
000010009
|
|
*more*
|
With Distinct
Career
|
Last School Attended
|
GRAD
|
|
GRAD
|
000000001
|
MEDS
|
000000001
|
UGRD
|
|
UGRD
|
000000001
|
UGRD
|
000010005
|
UGRD
|
000010008
|
UGRD
|
000010009
|
Back to top
To set a query to "distinct" mode, click the Properties link and check the Distinct check box.

Back to top