From: DaWiz Date: September 10 2008 7:02am Subject: Fw: Weird problem with mysql_query List-Archive: http://lists.mysql.com/mysql/214427 Message-Id: <6F8C5E4B78554C7BB8B6B6F769F9DC34@dawizii> MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit > > ----- Original Message ----- > From: "Darryle Steplight" > To: "MySql" > Cc: > Sent: Tuesday, September 09, 2008 6:59 PM > Subject: Re: Weird problem with mysql_query > > >> Hi G, >> There is nothing weird about your results. When you do a Count(*) >> without a GROUP BY(someColumn) you are essentially asking MySQL how >> many rows are present in the table. But when you do use Group By >> someColum , you are asking MySql how many rows do I have of >> "someColumn" . It's just a good practice to use GROUP BY when you >> want to a count of a specific column . >> >> mysql> select count(*) as 'Count' from logins GROUP BY dawiz >> I found my problem - it turned out to be a misconception on my part; I was using sprintf(buf,"%d", row[i]) if it was a numeric field - this was printing the address rather than the value. Apparently even though the data is type MYSQL_TYPE_LONGLONG it should be treated as char. G Vaughn