Originally posted by vijaya bacina:
Hi,
I wanted to avoid repeation of "select min(column) from table2)" because table2 has some million records. then it would be good to find min(coulmn) once and use it in condition..is there any way to do it.? or is it not possible?
If you have an index on the column of table 2, then it doesn't take too much time (less than 6/10ths of a second for the entire query on my database, when table 2 has 1,101,239 rows and table 1 has 3 rows), even when the min is found twice (most of the time goes to getting the consistent blocks into memory, which only happens once, unless your database is really really grossly overloaded).
If that's still not acceptable, use 2 statements: