SQL question

From: Date: Fri, 08 Dec 2000 22:22:41 +0000
Subject: SQL question
Groups: php.general 
Request: Send a blank email to php-general+get-29416@lists.php.net to get a copy of this message
Dear list, I want to make a query with a column saying yes/no depending on interest of a user. Suppose i have three tables: USER (userID, name) 1 Chris 2 Harry 3 Anna CATEGORIES (catID, name) 4 bicycles 5 windmills 20 trees USER_INTEREST (userID, catID) 1 4 1 5 2 4 2 20 3 20 I would like to get this query result: CATEGORIE.naam | user_2_is_interested --------------------------------- bicycles | yes windmills | yes trees | no As you see i want every categorie in one row (each once) and the next row says whether a user is interested. So i made this query: SELECT DISTINCT CATEGORIE.naam naam, IF (1=1,"yes","no") user_2_is_interested FROM categorie , user_cat As you see my IF condition is now 1=1. Of course i want to see whether the current user ($UID) is interested in this specific categorie. But as soon as i try to adapt the WHERE or the IF i get all sorts of doubles. Help? Chris -------------------------------------------------------------------- -- C.Hayes Droevendaal 35 6708 PB Wageningen the Netherlands -- --------------------------------------------------------------------

« previous php.general (#29416) next »