Hi Phani,

Hope this answers your Query.

SQLite version 3.1.3
Enter ".help" for instructions
sqlite> create table m( mNo integer, year integer, month integer );
sqlite> insert into m values (1, 2007, 9);
sqlite> insert into m values (2, 2006, 5);
sqlite> insert into m values (3, 2006, 5);
sqlite> insert into m values (4, 2004, 4);
sqlite> SELECT COUNT(*) FROM ( SELECT COUNT(*) FROM m group by year,month);
3
sqlite> 

Regards,

Bharath


On 9/25/07 3:59 PM, "B V, Phanisekhar" <[EMAIL PROTECTED]> wrote:

> Hi Simon,
> 
> Assume you have a following data:
> matchNo, year, month
> 34         2007     9
> 
> 27         2006     5
> 
> 26         2006     5
> 
> 24      2005     4
> 
> For the above data my answer should be 3, since there are three unique
> combination of year, month {(2007, 9), (2006, 5), (2005, 4)}. Here I
> need to find the number of distinct combinations of year, month not the
> count for a particular year, month.
> 
> Regards,
> Phani
> 
> 
> -----Original Message-----
> From: Simon Davies [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 25, 2007 3:14 PM
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] select COUNT (DISTINCT column1, column2) from
> table?
> 
> On 25/09/2007, B V, Phanisekhar <[EMAIL PROTECTED]> wrote:
> .
> .
>> Assume you have a following data:
>> 
>> matchNo, year, month
>> 
>> 34         2007     9
>> 
>> 27         2006     5
>> 
>> 26         2006     5
>> 
>> Now distinct year, month will return
>> 
>> 2007, 9
>> 
>> 2006, 5
>> 
>> Is there a way by which I can count (distinct year, month)
> combinations?
>> For this example answer should be 2.
>> 
>> Regards,
>> 
>> Phani
> 
> Hi Phani,
> 
> SQLite version 3.4.2
> Enter ".help" for instructions
> sqlite>
> sqlite> create table m( mNo integer, year integer, month integer );
> sqlite>
> sqlite> insert into m values (1, 2006, 11 );
> sqlite> insert into m values (2, 2007, 5 );
> sqlite> insert into m values (3, 2007, 5 );
> sqlite>
> sqlite> select count(*), year, month from m group by year,month;
> 1|2006|11
> 2|2007|5
> sqlite>
> 
> Rgds,
> Simon
> 
> ------------------------------------------------------------------------
> -----
> To unsubscribe, send email to [EMAIL PROTECTED]
> ------------------------------------------------------------------------
> -----
> 
> 
> -----------------------------------------------------------------------------
> To unsubscribe, send email to [EMAIL PROTECTED]
> -----------------------------------------------------------------------------
> 
> 



-----------------------------------------------
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an 
intended recipient, please notify the sender and delete all copies. Emails to 
and from our network may be logged and monitored. This email and its 
attachments are scanned for virus by our scanners and are believed to be safe. 
However, no warranty is given that this email is free of malicious content or 
virus.



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to