Re: DataObjects "HAVING" ?
| From: | Alan Knowles | Date: | Thu, 05 Jun 2003 03:06:29 +0000 |
| Subject: | Re: DataObjects "HAVING" ? | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-5808@lists.php.net to get a copy of this message | ||
Copy and Paste the WhereAdd code.. and call it havingAdd() - looks like the same kind of thing - I've never used having before :)
The Php_kid wrote:
Hi ! There is a way to put a "HAVING" on a SQL sentence with DataObject ? (without use "query()" method) --------------------------------------------- Example: I want to perform next query: SELECT id_lot FROM rel_lot_countries WHERE id_country=251 OR id_country=245 OR id_country=246 GROUP BY id_lot HAVING count(*)=3 -------------------------------------------------- And, with DataObjects, I have next code: $rel_lot_countries=new DataObjects_Rel_lot_countries(); $total=count($_POST['countries']); $foreach($_POST['s_countries'] as $val) { $rel_lot_countries->whereAdd('id_country='.$val,'OR'); } $rel_lot_countries->groupBy('id_lot');$whereAdd('id_country IN ('.implode(',',$_POST['s_countries']).')'); // although you should really 'sanitize the POST... Regards Alan
????? $rel_lot_countries->having ???? -------------------------------------------------- Help me !! Thank you Regards, mac -- ...ThE PhP_KiD.