Hi Andres, I think that as long as you have an index defined on CONTENT_DATA.id_content that should perform ok. Brian -----Original Message----- From: Andres Santos [mailto:asantos@xxxxxxxxx] Sent: 10 March 2006 22:11 To: Php Objects (List) Subject: sql Optimization Hi is there a way to optimize this php sql query? i have these two predefined variables: $id_section = 1; (first section of the website) $id_language = 1; (english lang id) $sql = 'SELECT content_data.title, content_data.data FROM content INNER JOIN content_data ON content.id_content = content_data.id_content WHERE (((content.id_section)='.$id_section.') AND ((content.flg_public)=True) AND ((content_data.id_language)='.$id_language.')) ORDER BY content.order'; These are the two tables involved in the sql query: CONTENT * id_content * id_section * order * flg_public CONTENT_DATA * id_content_data * id_content * id_language * title * data The sql string was generated through ms access wizard, but i think there might be a better way to do that. (i dont know much about INNER JOINS). Thanks, Andres -- Slds, Andrés Santos, IIG ***************************** cel: (593) 9 7026627 http://www.egobits.com ***************************** PHP Data object relational mapping generator http://www.metastorage.net/ Yahoo! Groups Links PHP Data object relational mapping generator http://www.metastorage.net/ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-objects/ <*> To unsubscribe from this group, send an email to: php-objects-unsubscribe@xxxxxxxxxxxxxxx <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/