mysql - How to join my "clients" and "messages" tables? -


there 2 tables:

clients ___________ idclient int login varchar  messages ___________ idmessage int datewakeup datetime .... other fields 

i need each client count number of entries in table messages in given range of time. tried this:

select c.login, count(m.idmessage) clients c, messages m     m.idclient=c.idclient , m.datewakeup>'2010-09-01 00:00:01'     , m.datewakeup<'2010-10-01 00:00:01'; 

it not working.

when using count(...), have group by results:

select c.login, count(m.idmessage) clients c, messages m m.idclient=c.idclient , m.datewakeup>'2010-09-01 00:00:01' , m.datewakeup<'2010-10-01 00:00:01' group c.login 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -