Re: SELECT COUNT - result from two tables

From: Date: Thu, 06 Nov 2003 13:20:04 +0000
Subject: Re: SELECT COUNT - result from two tables
References: 1 2 3  Groups: php.db 
Request: Send a blank email to php-db+get-31475@lists.php.net to get a copy of this message
From: "Boyan Nedkov" <k24d88@home.nl> > Putting more than one table in the FROM clause means tables are joined, > then at least following problems could arise: > > - using WHERE clause you can have empty recordset returned and then > COUNT conflicts with it because there is actually no any data to be > returned; There won't be a conflict, COUNT(*) will just return zero. When you use COUNT(*) there will _always_ be a row returned, either zero or the count. > - joining two (or more) tables without using aliases to the equally > named columns in the SELECT/WHERE/COUNT clauses will produce error > message instead of expecting data; You don't need an alias and the columns don't have to be equally named, but yes, you have to "join" them somehow against some column. The original query had this. > - COUNT(*) wont work if u have equal table names in the tables; I have no idea what you mean by that. ---John Holmes...

« previous php.db (#31475) next »