×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Thank Eric. You SQL work perfectly. I'm surprise to see that it
actually running faster than the version that I've.



"DeLong, Eric" <EDeLong@xxxxxxxxxxxxxxx> wrote in message
news:<mailman.14701.1246043120.23468.rpg400-l@xxxxxxxxxxxx>...
What about

Select count(distinct digits(index_number) concat type) from
invoice_files where status
= 'P' and file_name like '%invoiceFileName%'

This presumes that "index_number" is in fact numeric, and "type" is
char.

-Eric DeLong

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of hockchai Lim
Sent: Friday, June 26, 2009 1:41 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: count( distinct index_number, type )

Anyone know how I can convert this mysql select statement into the DB2
equivelant?

select count( distinct index_number, type ) from invoice_files where
status
= 'P' and file_name like '%invoiceFileName%'

I come up with this:
with a as
(select distinct index_number, type from invoice_files
where status = 'P' and file_name like '%invoiceFileName%'
group by index_number, type order by index_number, type)
select count(*) from a



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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

This mailing list archive is Copyright 1997-2026 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.