May 23, 2006 at 6:40 pm
Hi, I have 12 columns, one for each month, the column has a float value I need to retrieve based on a parameter that my stored procedure will receive, along with other 5 columns that have descriptions, ids and other stuff
What is the more efficient way to structure the query? or do i have to repeat the query 12 times?
May 23, 2006 at 6:45 pm
You need to normalise your table.
_____________
Code for TallyGenerator
May 23, 2006 at 7:24 pm
as a short-term fix (until you implement the above recommendation, perhaps with a table holding yearid, monthid, your float value and a FK back to the original table), you can use the simple case statement:
Tim Wilkinson
"If it doesn't work in practice, you're using the wrong theory"
- Immanuel Kant
May 23, 2006 at 7:25 pm
I half-changed it from searched to simple
Tim Wilkinson
"If it doesn't work in practice, you're using the wrong theory"
- Immanuel Kant
May 23, 2006 at 7:26 pm
I promise to check my code properly in future...
Tim Wilkinson
"If it doesn't work in practice, you're using the wrong theory"
- Immanuel Kant
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply