× 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.



All that does is give you the maximum status, no count.  In my previous answer I forgot to name the aggregate field (the result of the MAX).  You can name it the same as the field you are aggregating, as so (note the additional underlined word):

with maxstat as (
select gs1, max(status)*_status_ *from table
where ts between ts1 and ts2
group by gs1)
select status, count(*) from maxstat
group by status order by status


On 1/2/2020 2:02 PM, Art Tostaine, Jr. wrote:
Thanks Joe. That gave me error Status not found. This one worked.

with maxstat as (
select count(gs1), max(status) from table
where ts between '2019-12-30' and '2020-01-02'
group by status)
select * from maxstat



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.