Why is this returning the wrong COUNT of table1?
'table1' has a total of 5 records.
Query:
"SELECT COUNT(table1.id) FROM table1, table2 WHERE registered='Y'";
Note: registered is a column in table2.
This query is returning the COUNT as 29 records??? But there are only 5 records total in table1??? How could this be? Thanks!
Easy... but something is wrong?!!?
Moderator: General Moderators
- seodevhead
- Forum Regular
- Posts: 705
- Joined: Sat Oct 08, 2005 8:18 pm
- Location: Windermere, FL
-
RobertPaul
- Forum Contributor
- Posts: 122
- Joined: Sun Sep 18, 2005 8:54 pm
- Location: OCNY
- seodevhead
- Forum Regular
- Posts: 705
- Joined: Sat Oct 08, 2005 8:18 pm
- Location: Windermere, FL
- seodevhead
- Forum Regular
- Posts: 705
- Joined: Sat Oct 08, 2005 8:18 pm
- Location: Windermere, FL
Re: Easy... but something is wrong?!!?
Do you know what happens when you select from more than one table?seodevhead wrote:Why is this returning the wrong COUNT of table1?
'table1' has a total of 5 records.
Query:
"SELECT COUNT(table1.id) FROM table1, table2 WHERE registered='Y'";
Note: registered is a column in table2.
This query is returning the COUNT as 29 records??? But there are only 5 records total in table1??? How could this be? Thanks!
Do you know what happens if you specifiy a column as argument in an aggregate function?
If not, it's up to you to do some research.