I'm using queries containing some various clauses and I use concatenation on SQL statements. But I think you're right : if my statements had to be much more flexible, as in your exemple, Criteria would be more suitable. Unfortunately it suffers from various bugs that made me prefer sql statements. Morover, as I'm using a lot of sql functions like NOW() or SUBSTRING()... all of my criterias were CUSTOM like, so I realised that it would be quicker to write it directly in sql with some concatenations for values. So if anybody has to choose between sql statements and criterias I'd say it depends on the needs. But anyway (here I talk to Javier), you don't have to absolutely use Criteria to prove to your collegues that Torque is powerful. Thank you for your answer Michael Regards Amine -----Message d'origine----- De : Michael Burschik [mailto:Burschik@lotto-berlin.de] Envoyé : mercredi 12 novembre 2003 13:41 À : 'Apache Torque Users List' Objet : AW: Simple select in Torque gets difficult??? If you have a static SQL statement, then using executeQuery may well be easier. If your SQL statement may or may not contain various clauses, depending on the user's input, for example, Criteria are much easier to use, in my opinion. Consider the following example: a portlet is supposed to display how often numbers have been drawn in a lottery. The user can select whether he wishes to consider draws on Wednesday, Saturday or both, whether he wishes to see the results for the six numbers of the main draw, or for all seven, and whether the numbers will be sorted according to the frequency of their occurrence or not. Using Criteria, this is pretty easy to do (or would be, if "count(*)" worked), since you can add the criteria you need without sweating over SQL syntax and the correct placement of parentheses, whereas building the SQL statement manually by concatenating strings is quite a pain, and rather error-prone. Moreover, for simple queries, you can use Criteria without being familiar with SQL, which might well be an advantage. Regards Michael Burschik --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org