How to count number of distinct rows

  • Follow


Hi all

I want to count the number of distinct rows. how to rewrite below
query ?

select distinct modifyts_date, sync_last_begin_date from
pub.order_sync;

.....
....
2007-09-06    2007-09-07
2007-09-07    2007-09-07
2007-09-08    2007-09-08
2007-09-08    2007-09-09
2007-09-09    2007-09-09
2007-09-10    2007-09-10
2007-09-11    2007-09-11
2007-09-11    2007-09-13
2007-09-12    2007-09-12
2007-09-12    2007-09-13
2007-09-13    2007-09-13
2007-09-14    2007-09-14
2007-09-17    2007-09-17

0
Reply moon_ils-se (53) 9/21/2007 8:38:58 AM

moonhk wrote:
> Hi all
>
> I want to count the number of distinct rows. how to rewrite below
> query ?
>
> select distinct modifyts_date, sync_last_begin_date from
> pub.order_sync;
>
> ....
> ...
> 2007-09-06    2007-09-07
> 2007-09-07    2007-09-07
> 2007-09-08    2007-09-08
> 2007-09-08    2007-09-09
> 2007-09-09    2007-09-09
> 2007-09-10    2007-09-10
> 2007-09-11    2007-09-11
> 2007-09-11    2007-09-13
> 2007-09-12    2007-09-12
> 2007-09-12    2007-09-13
> 2007-09-13    2007-09-13
> 2007-09-14    2007-09-14
> 2007-09-17    2007-09-17

SELECT COUNT(DISTINCT modifyts_date, sync_last_begin_date)
FROM pub.order_sync;


0
Reply Paul 9/21/2007 11:04:21 AM


On 9 21 ,   7 04 , "Paul Lautman" <paul.laut...@btinternet.com> wrote:
> moonhk wrote:
> > Hi all
>
> > I want to count the number of distinct rows. how to rewrite below
> > query ?
>
> > select distinct modifyts_date, sync_last_begin_date from
> > pub.order_sync;
>
> > ....
> > ...
> > 2007-09-06    2007-09-07
> > 2007-09-07    2007-09-07
> > 2007-09-08    2007-09-08
> > 2007-09-08    2007-09-09
> > 2007-09-09    2007-09-09
> > 2007-09-10    2007-09-10
> > 2007-09-11    2007-09-11
> > 2007-09-11    2007-09-13
> > 2007-09-12    2007-09-12
> > 2007-09-12    2007-09-13
> > 2007-09-13    2007-09-13
> > 2007-09-14    2007-09-14
> > 2007-09-17    2007-09-17
>
> SELECT COUNT(DISTINCT modifyts_date, sync_last_begin_date)
> FROM pub.order_sync;-         -
>
> -         -

Thank, Our version sql not support below.
SQLExplorer>SELECT COUNT(DISTINCT modifyts_date,
sync_last_begin_date)
1> from pub.order_sync;
=== SQL Exception 1 ===
SQLState=42000
ErrorCode=-20003
[JDBC Progress Driver]:Syntax error (7587)
SQLExplorer>

0
Reply moonhk 9/24/2007 4:28:25 AM

On 9 24 ,   12 28 , moonhk <moon_ils...@yahoo.com.hk> wrote:
> On 9 21 ,   7 04 , "Paul Lautman" <paul.laut...@btinternet.com> wrote:
>
>
>
>
>
> > moonhk wrote:
> > > Hi all
>
> > > I want to count the number of distinct rows. how to rewrite below
> > > query ?
>
> > > select distinct modifyts_date, sync_last_begin_date from
> > > pub.order_sync;
>
> > > ....
> > > ...
> > > 2007-09-06    2007-09-07
> > > 2007-09-07    2007-09-07
> > > 2007-09-08    2007-09-08
> > > 2007-09-08    2007-09-09
> > > 2007-09-09    2007-09-09
> > > 2007-09-10    2007-09-10
> > > 2007-09-11    2007-09-11
> > > 2007-09-11    2007-09-13
> > > 2007-09-12    2007-09-12
> > > 2007-09-12    2007-09-13
> > > 2007-09-13    2007-09-13
> > > 2007-09-14    2007-09-14
> > > 2007-09-17    2007-09-17
>
> > SELECT COUNT(DISTINCT modifyts_date, sync_last_begin_date)
> > FROM pub.order_sync;-         -
>
> > -         -
>
> Thank, Our version sql not support below.
> SQLExplorer>SELECT COUNT(DISTINCT modifyts_date,
> sync_last_begin_date)
> 1> from pub.order_sync;
> === SQL Exception 1 ===
> SQLState=42000
> ErrorCode=-20003
> [JDBC Progress Driver]:Syntax error (7587)
> SQLExplorer>-         -
>
> -         -


I get it using view and count
SQLExplorer>create view er as select distinct modifyts_date,
sync_last_begin_date from pub.order_sync;
SQLExplorer>select count(*) from er;
   count(*)
-----------
       1311
SQLExplorer>

0
Reply moonhk 9/24/2007 7:50:47 AM

3 Replies
178 Views

(page loaded in 0.399 seconds)

Similiar Articles:













7/25/2012 1:16:49 PM


Reply: