A simple query question that I really ought to know the answer to but don't:
Given a table with multiple columns in it how do I count how many entries there are with column A matching some value where column B is distinct? sqlite> create table a (a, b); sqlite> insert into a values (10, 1); sqlite> insert into a values (10, 2); sqlite> insert into a values (10, 2); sqlite> insert into a values (11, 2); sqlite> insert into a values (11, 2); sqlite> insert into a values (11, 3); sqlite> select * from a where a=10 group by b; 10|1 10|2 sqlite> select * from a where a=11 group by b; 11|2 11|3 How can I do count equivalent of such a query to find out how many distinct values of b there are for a given a? (That is get an answer of 2 in the above) Thanks -- Matthew Jones Hewlett-Packard Ltd Long Down Avenue Stoke Gifford Bristol. BS34 8QZ Tel: +44 (0) 117 312 7490 Email: matthew.jo...@hp.com<mailto:matthew.jo...@hp.com> Hewlett-Packard Limited registered Office: Cain Road, Bracknell, Berks, RG12 1HN. Registered No: 690597 England The contents of this message and any attachments to it are confidential and may be legally privileged. If you have received this message in error, you should delete it from your system immediately and advise the sender. To any recipient of this message within HP, unless otherwise stated you should consider this message and attachments as "HP CONFIDENTIAL". _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users