2007/9/15, rihad <rihad@xxxxxxx>: > How can I efficiently return the minimum/maximum of two given > expressions? Like SELECT MYMIN(a+b-c,d+e*f). > > Thanks. Hello use function GREATEST (maximim) or LEAST (minimum) http://www.postgresql.org/docs/8.2/interactive/functions-conditional.html#AEN13148 Regards Pavel Stehule ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match