I have a table with the following structure a b c wkno sun_1 mon_2 tue_3 wed_4 thu_5 fri_6 sat_7
I need to select abc for a particular date but don't have column that would specify the date. It just a weekno and split up of days. Based on the column value for sun_1,mon_2,tue_3,wed_4,thu_5,fri_6, sat_7 i need to frmulate the date.
For example if i have a value >0 for any of the days then the weekno+the day(sun_1 for ex) will give a date.
For example weekno 10000 indicates 1 week of 2009 then if Sat_7 has a value >0 the date would be 3-Jan-2009.
How do i write a sql to do this? Also i would have tod o this for a 200 million rows so the performance is also a major consideration. Is there any function that could do this???