<p>I have an Informix SQL query which returns a set of rows. It was slightly modified for the new version of the site we've been working on and our QA noticed that the new version returns different results. After investigation we've found that the only difference between two queries were in the number of fields returned.</p>

<p>FROM, WHERE and ORDER BY clauses are identical and the column names in the SELECT part did not affect the results. It was only the number of fields which caused the problem.</p>

<p>Any ideas?</p>

Adding
```
--+ ORDERED
```
join-order directive fixes the problem by allowing you to get your results in predictable order each time.
The links goes to the description of how the directive works
http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.sqls.doc/sqls1144.htm
Use the ORDERED join-order directive
  to force the optimizer to join tables
  or views in the order in which they
  appear in the FROM clause of the
  query.
```
```
SELECT --+ ORDERED
   name, title, salary, dname
FROM dept, job, emp WHERE title = 'clerk' AND loc = 'Palo Alto' 
   AND emp.dno = dept.dno 
   AND emp.job= job.job;
```
```