how to retrieve the particular cell details based on the color?

Posted by Tejamanimala under C# on 10/22/2013 | Points: 10 | Views : 1279 | Status : [Member] | Replies : 1
hi i have a application which is having hikes excel sheet,first am uploading hikes excel sheet into database.that excel sheet and databse table are having same columns.

in hikes sheet i have these columns....

id,name,doj,jan-11 ,feb-11,mar-11,apr-11,may-11,jun-11,july-11,aug-11,sep-11,nov-11,dec-11,jan-12,feb-12,mar-12,apr-12,may-12,jun-12,july-12,aug-12.sep-12,oct-12,nov-12, this we are maintaining 3 years hikes one excel if a employee joined(doj) in jan-11,if will get 6000,then the hike will be in jan-12 as 8000,like that we are giving yearly hike ,for this am giving red color to hike (ex:8000).now in one page i have one textbox with name as empid,based on that empid i want to retrieve the hike details,i want to display the id,name,sal,jan-12,jan-13,jan-14,,,,,,like this every employee joined in different year and month,and he will gwt hikes at different months,how to retrive the only id,name,hikes.(here i want to display like this ...jan-11 jan12

6000 8000



Posted by: Bandi on: 10/22/2013 [Member] [MVP] Platinum | Points: 25

Means if a employee joined in Jan-2011 then he will get the hike in Jan-12 and then on Jan-13 and so on...
NOTE: if emp getting hike exactly on next year same month AND other columns of respective emp is NULL then you can do like as below:
SELECT id, name, doj, COALESCE( [Jan-11], [Feb-11], [Mar-11], [Apr-11], [May-11], [Jun-11], [Jul-11], [Aug-11], [Sep-11], [Oct-11] ,[Nov-11] ,[Dec-11]) AS FirstHike,
COALESCE( [Jan-12], [Feb-12], [Mar-12], [Apr-11], [May-12], [Jun-12], [Jul-12], [Aug-12], [Sep-12], [Oct-12] ,[Nov-12] ,[Dec-1]) As SecondHike
COALESCE( [Jan-13], [Feb-13], [Mar-13], [Apr-13], [May-13], [Jun-13], [Jul-13], [Aug-13], [Sep-13], [Oct-13] ,[Nov-13] ,[Dec-13]) As ThirdHike
FROM TableName

Mark This Response as Answer

Tejamanimala, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response