HELP....
I am trying to read a table that has 598,865 records. The problem is when I try to access it by year. When I use the following query it is fast :
But when I use the following subquery it is slower :
NOTE : parameter_table is a table with 1 record and 2 fields : yr_today(number , in this case 2009) and yr_prev(number, in this case 2008).
Can anyone help me with the second query so it can be faster, because I don't like to hard code data in the queries.
I am trying to read a table that has 598,865 records. The problem is when I try to access it by year. When I use the following query it is fast :
Code:
SELECT table_data.name, table_data.amount FROM table_data WHERE yr = 2009
Code:
SELECT table_data.name, table_data.amount FROM table_data WHERE yr = (select yr_today from parameter_table)
Can anyone help me with the second query so it can be faster, because I don't like to hard code data in the queries.
Comment