Bluehost.com Web Hosting $6.95

How to count number of distinct rows

This is a discussion on How to count number of distinct rows within the MySQL Database forums, part of the Database Forums category; Hi all I want to count the number of distinct rows. how to rewrite below query ? select distinct modifyts_date, sync_last_begin_date ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-21-2007
moonhk
 
Posts: n/a
Default How to count number of distinct rows

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

Reply With Quote
  #2 (permalink)  
Old 09-21-2007
Paul Lautman
 
Posts: n/a
Default Re: How to count number of distinct rows

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;


Reply With Quote
  #3 (permalink)  
Old 09-24-2007
moonhk
 
Posts: n/a
Default Re: How to count number of distinct rows

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>

Reply With Quote
  #4 (permalink)  
Old 09-24-2007
moonhk
 
Posts: n/a
Default Re: How to count number of distinct rows

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>

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:17 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0