Re: SQL select basics

2008-10-20 Thread Moon's Father
select * from ( SELECT ID_number, count( CU_number ) AS CC FROM MyTable GROUP BY ID_number ) T WHERE CC = ( select max(cc) from ( SELECT ID_number, count( CU_number ) AS CC FROM MyTable GROUP BY ID_number ) T2 ) On Wed, Oct 15, 2008 at 5:08 PM, dave aptiva <[EMAIL PROTECTED]>wrote: > Hello a

Re: SQL select basics

2008-10-17 Thread Jim Lyons
SELECT ID_number, count( CU_number ) FROM MyTable GROUP BY ID_number order by 2 desc limit 10 will give you the top 10. Change 10 to whatever you want or take off the limit clause to get all records. On Fri, Oct 17, 2008 at 4:25 AM, dave aptiva <[EMAIL PROTECTED]>wrote: > Hello all, > > I'm new

SQL select basics

2008-10-17 Thread dave aptiva
Hello all, I'm new to sql and have a question if someone would be kind enough to help me with, if I have a table that stores telemarketers by ID_number and the customer that they spoke to by CU_number and I use a select statement such as; SELECT ID_number, count( CU_number ) FROM MyTable G

Re: SQL select basics

2008-10-17 Thread Ian Christian
2008/10/17 dave aptiva <[EMAIL PROTECTED]>: > > I tried SELECT ID_number, max( count( CU_number ) ) but this causes an error > "# - Invalid use of group function " # sqlite3 SQLite version 3.5.9 Enter ".help" for instructions sqlite> create table moo (id_number, cu_number); sqlite> insert int

SQL select basics

2008-10-17 Thread dave aptiva
Hello all, I'm new to sql and have a question if someone would be kind enough to help me with, if I have a table that stores telemarketers by ID_number and the customer that they spoke to by CU_number and I use a select statement such as; SELECT ID_number, count( CU_number ) FROM MyTable G