PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > How to count number of distinct rows
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
How to count number of distinct rows

Réponse
 
LinkBack Outils de la discussion
Vieux 21/09/2007, 09h38   #1
moonhk
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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

  Réponse avec citation
Vieux 21/09/2007, 12h04   #2
Paul Lautman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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;


  Réponse avec citation
Vieux 24/09/2007, 05h28   #3
moonhk
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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>

  Réponse avec citation
Vieux 24/09/2007, 08h50   #4
moonhk
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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>

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 21h36.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10837 seconds with 12 queries