Precisely Speaking
May 21, 2012, 07:05:20 PM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
: So what's news with you? Tell us about it in "Getting To Know You"!
Home
Help
Calendar
Login
Register
Precisely Speaking
>
Training and Education
>
U2 Programming Questions
>
SELECT DISTINCT in UniQuery?
Pages: [
1
]
Go Down
« previous
next »
Print
Author
Topic: SELECT DISTINCT in UniQuery? (Read 708 times)
initself
Professional
Posts: 10
SELECT DISTINCT in UniQuery?
«
on:
February 15, 2011, 02:57:36 PM »
How do you write a SELECT DISTINCT like statement in UniQuery?
SQL: SELECT DISTINCT(last_update) FROM cust_type;
Logged
Tom Pellitieri
Rock Star
Posts: 171
Tom Pellitieri - Toledo, Ohio
Re: SELECT DISTINCT in UniQuery?
«
Reply #1 on:
February 16, 2011, 06:23:23 AM »
The following is for UniData - not certain for UniVerse.
If you want to display data from a file with unique values, you typically would use:
SORT cust_type BY last_update BREAK-ON last_update (other_fields) DET-SUPP
If you want to get a select list of the unique values, you need to use the SAVING UNIQUE qualifier. This only works with the UniData ECL Type, so I typically make certain I type the command in lower case from the SB+ TCL prompt.
SELECT cust_type WITH ...
select cust_type SAVING UNIQUE last_update
Note that this creates a sorted list that, depending on what is selected, may included "locators". For example, if your unique values are A, B and C, your list may be
A^1^1
B^1^1
C^1^2
This shows that A and B were in Attribute 1, value 1, and C was in Attribute 1 value 2.
If the field you're selecting is the key to another file, you can just select that file to clean up the list. Otherwise, you should save the list and delete the "locators".
--Tom
Logged
precisonline
President/Chief Technologist
Administrator
Rock Star
Posts: 1532
Re: SELECT DISTINCT in UniQuery?
«
Reply #2 on:
February 17, 2011, 10:16:17 AM »
+1 to what Tom said.
Logged
-Kevin
Accidents "happen"; success, however, is planned and executed.
Pages: [
1
]
Go Up
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> Getting To Know You
=> Announcements
=> Big Thoughts / Cool Ideas
=> Rants & Raves
-----------------------------
Application Support
-----------------------------
=> Red Leaf
=> Activant/Prelude Support
=> Summit Support
=> Avante Support
=> PRC Support
-----------------------------
Training and Education
-----------------------------
=> Connect!
=> U2 Programming Questions
=> SB+ Programming Questions
=> Web Programming Questions
=> Business Intelligence / MITS
=> PC / Hardware / Miscellaneous Support
Loading...