× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Matt, The select count gives you a total. What I need is the details and the 
totals on the same output.

1. ABC
2. DEF

Total 2

My main Select is a Select Distinct so I can remove the dups.
Thank you,
Rob400
> -----Original Message-----
> From: Haas  Matt [mailto:Matt.Haas@xxxxxxxxxxx]
> Sent: Thursday, March 18, 2004, 1:33 PM
> To: RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
> Subject: RE: SQL
> 
> Rob,
> 
> Are you trying to get a count of the number of rows? If so you use a query
> such as:
> 
> select count(*) from myfile where somecondition=true
> 
> If you're trying to add the values from a particular column (to get a total),
> you'd do something like:
> 
> select sum(number_field) from myfile where somecondition=true
> 
> If you want these for the entire file, just leave off the where clause.
> 
> I don't know that I'd recommend any of the books in the Info Center for
> learning SQL but there are several good books on the subject and you should be
> able to find them at a book store that carries computer books (or Amazon.com).
> 
> Matt
> 
> -----Original Message-----
> From: simafrog [mailto:SimaFrog@xxxxxxxxxx]
> Sent: Thursday, March 18, 2004 4:15 PM
> To: RPG programming on the AS400 / iSeries
> Subject: SQL
> 
> 
> HI I am not sure if this is the right list for an SQL question, as I don't see
> any specific SQL List. 
> I would like to know how to add a column for each record simply as a
> sequential number and then getting a total at the end (count). I do not see
> this anywhere on my STRSQL on the AS/400. If this is the wrong list, please
> re-direct me to the proper one.
> Thanks,
> Rob
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
> 
> 
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
> 

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.