"Thalis A. Kalfigopoulos" wrote:
> > +----------+------------+--------------+-------------+
> > | task | comment | remarks | history |
> > +----------+------------+--------------+-------------+
> > | task_1 | cmt_1 | rmk_1 | |
> > | task_1 | cmt_2 | | |
> > | task_1 | cmt_3 | | hst_1 |
> > | task_1 | cmt_4 | rmk_2 | |
> > | task_1 | cmt_5 | | hst_2 |
> > | task_1 | cmt_6 | | |
> > +----------+------------+--------------+-------------+
>
> SELECT table1.task,COUNT(table2.comment),COUNT(table2.remarks),COUNT(table3.history)
> FROM table1 LEFT JOIN table2 ON table1.id=table2.todoid
> LEFT JOIN table3 ON table1.id=table3.todoid WHERE table1.id=10
> GROUP BY table1.task;
Based on the above data, and the above select, I get the following:
+----------+---------+---------+-----------+
| task | comment | remarks | history |
+----------+---------+---------+-----------+
| task_1 | 6 | 6 | 2 |
+----------+---------+---------+-----------+
Obviously there are not 6 remarks, but only 2. So why is it counting 6? Is it
because it's in the same table as the comments, and there are 6 comments? Does this
mean MySQL counts an empty cell as having data in it?
--
H | Hi, I'm currently out of my mind. Please leave a message. BEEEEP!
|____________________________________________________________________
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ashley M. Kirchner <mailto:[EMAIL PROTECTED]> . 303.442.6410 x130
Director of Internet Operations / SysAdmin . 800.441.3873 x130
Photo Craft Laboratories, Inc. . eFax 248.671.0909
http://www.pcraft.com . 3550 Arapahoe Ave, #6
.................. . . . . Boulder, CO 80303, U.S.A.
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php