Your ORDER BY should read as GROUP BY instead.

Elvis

Celebrating 11-Years of SQL Performance Excellence on IBM i, i5/OS and
OS/400
www.centerfieldtechnology.com


-----Original Message-----
Subject: Re: SQL: How to get number of records (based on a prefix)

I am doing:

WITH PREFIX AS
(SELECT DISTINCT ITNBR,SUBSTR(STID,1,1) FROM ITMRVA)
SELECT ITNBR,COUNT(*) FROM PREFIX ORDER BY ITNBR

... and it is giving me the error:
Token was not valid. Valid tokens: ( + * - ? : DAY RRN CASE CAST CHAR
DATE DAYS HASH HOUR LEFT TIME.

The cursor is placed between DISTINCT and ITNBR...

PETER VIDAL




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.