Re: SQL question

From: Date: Mon, 11 Dec 2000 23:45:36 +0000
Subject: Re: SQL question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-29769@lists.php.net to get a copy of this message
Dear Rick, thanks very much for the solution! I'm going through a steep learning curve with SQL. Your query learned me a lot! I'm not sure whether the mistake in your example was a typo or meant as an educational way of forcing me to understand what's happening. But I assure you I really try to understand every step: [tables: Users (UserID, Name), Categories (CatID, Category), Interest (UserID, CatID) ] > SELECT Name, Category, > SUM( if( Users.UserID = Interest.UserID, 1, 0 )) > AS Interested > FROM Users, Categories LEFT JOIN Interest USING( UserID )) ( UserID )) should be ( CatID ) > GROUP BY Name, Category > ORDER BY Name, Category (I found this when trying to explain this on the phone to my father. Thanks for listening and trying, papa.) I am also much obliged to David Fordham for provoking Rick by claiming it could not be done in MySQL! ;-) I'm sorry but I don't agree with David that Oracle's query is in any way better. BTW the organisations i work for can't afford Oracle. They can't even pay me. But they work for good causes so that's why i do it for them. greetings, Chris -------------------------------------------------------------------- -- C.Hayes Droevendaal 35 6708 PB Wageningen the Netherlands -- --------------------------------------------------------------------

« previous php.general (#29769) next »