AS/400 query select count distinct

5 pts.
Tags:
AS/400
AS/400 Query
SQL
Hello, does someone knows how I can count distinct values on a column via query select? (same as count distinct via SQL)

Answer Wiki

Thanks. We'll let you know when a new response is added.

With AS400 query, it is a two step approach.

First you sort and build a work file summarizing some file taking a level break an your ‘Distinct” field.

Now the number of records in that file (minus 1 because of the total record) will be your distinct count. 

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta

    SQL is a query, so it's not clear what you mean by "...query select? (same as count distinct via SQL)". I'd guess that you're asking about Query/400 (or Query for i5/OS or whatever version you're using).

    Since a COUNT is necessarily a summary function, you'd select the 'Select report summary functions' option when defining the query. In that option, you choose which fields you want to COUNT.

    Tom

    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following