[SQL] Join optimization

2007-08-10 Thread Pablo Barrón
Hi! I've been trying to optimize a query in which I join several tables, since I've seen it takes about 2 seconds, which is way too much. Well, the query is the following, I'm using LEFT OUTER JOIN just when the tables can have NULL results, plain JOIN otherwise: select ="select to_char(a.fecha_

[SQL] ordering by multiple columns

2007-03-14 Thread Pablo Barrón
Hi! I'm trying to order a list in which the first parameter to order is a specific field, and the second should vary depending on a specific condition. More explicit, I would like to do something like: - ORDER BY a.column1, [b.column2 if c.value != 19 || c.column2 if c.value==19] That is to say