DB_OB DISTINCT

From: Date: Sun, 07 Dec 2003 01:29:14 +0000
Subject: DB_OB DISTINCT
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-9344@lists.php.net to get a copy of this message
Hi! I am looking for a way to fetch information from 3 tables: Table a: Contains information about a person: Pid & some data Table b: Is a connection to another table Pid & another ID of another table Table c: Is also a connection to another table Pid & another ID of another table Now I want to join table b and c to a: In DB_OBJECTS: $a->selectAs(); $a->joinAdd($b); $a->joinAdd($c); no selectAs needed as I don't need the information from the other tables - just want to be able to set where-clauses Unfortunately I get the rows from table a more than once if they have more than 1 matching row in table b or c. A "DISTINCT" would cut it down to what I really need. But how can I set Distinct in DB_OBJECTS? I explained the whole story because I think there might be a better way to do it than DISTINCT. I know - I could just use $a->query() but it is for a search engine which has lots of possible WHERE clauses and that would be just very easy with DB_OBJECTS ... Is it possible to get the generated query before fetching anything? Then I would only need to add the DISTINCT at the right position (Which would be simply replacing "SELECT" by "SELECT DISTINCT"). Thanks for your thoughts! Regards Daniel

« previous php.pear.general (#9344) next »