LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 01-03-2008, 09:33 AM   #1
kpachopoulos
Member
 
Registered: Feb 2004
Location: Athens, Greece
Distribution: Gentoo,FreeBSD, Debian
Posts: 704

Rep: Reputation: 30
mysql count(*) unexpected result


Hi,
i issue the following query
"SELECT * FROM Xtable WHERE time="20080102000000;"
and i get 19768 rows returned.
Then i execute:
"SELECT COUNT(*) FROM Xtable WHERE time="20080102000000;"
where i get 27869 rows returrned!

Can anybody explain or speculate what is going on?
 
Old 01-03-2008, 09:52 AM   #2
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 241Reputation: 241Reputation: 241
is your table always updated? How long you waited before you issued the second command?
 
Old 01-03-2008, 10:01 AM   #3
kpachopoulos
Member
 
Registered: Feb 2004
Location: Athens, Greece
Distribution: Gentoo,FreeBSD, Debian
Posts: 704

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by ghostdog74 View Post
is your table always updated? How long you waited before you issued the second command?
Hi ghostdog74,
I didn't update the table in between. I issued the first command and afterwards issued the second command.
 
Old 01-03-2008, 11:08 AM   #4
lionheart620
LQ Newbie
 
Registered: Jan 2008
Posts: 2

Rep: Reputation: 0
That doesn't make any sense, which leads me to believe it's a human error. Copy the queries you put in the first post (it's imperative you copy and paste) into the MySQL command line and see if the result you get is what you explained your initial post. If the result is not the same, then fix the queries so that they "work" as explained in the first post and then copy and paste the queries here.

Perhaps you left out the keyword DISTINCT from the first query? This could only be the case if you don't have a unique key defined (and assuming you actually did a select *).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
php display mysql result in pages god93 Programming 2 11-18-2007 07:58 AM
Search result MYSQL using dropdown list koscek Programming 2 11-02-2007 07:42 AM
MySQL - Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 9 jasontn Linux - Software 0 02-09-2005 01:17 PM
MySQL queries from Shell - unexpected result philipz Programming 5 05-04-2004 06:38 PM
cp command problem..... unexpected result hamster Linux - General 2 04-10-2003 05:57 PM


All times are GMT -5. The time now is 06:29 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration