I want to get the result from the below table like this …,
Expected result :
Fldempployee flddept Date Day Week off
00625267-Karthick S Corporate 04-25-2012 Wednesday
(or)
00625267-Karthick S Corporate 04-28-2012 Saturday Week end
(or)
00625267-Karthick S Corporate 04-29-2012 sunday Week end
(or)
00625267-Karthick S Corporate 04-27-2012 Friday
My Table structure like this.
F_id flddept fldemployee fldintime fldouttime fldlateafter fldearlybefore fldweekoff fldshiftname fldassigndate fldfromdate fldtodate fldrefid
1 Corporate 00625267-Karthick S 09:30 am 06:15 pm 09:30 am 06:15 pm Sat,Sun, COR-General Shift 04-25-2012 04-01-2012 05-31-2012
In fldweekoff column have two values sat and sunday.It may be Mon and wednesday.I want to search a record for a specific date means the above one record displayed like that with the week off field.The specific date is not in week off means it should displayed null value..’
try this
SELECT Fldempployee,flddept,fldassigndate AS date,DAYNAME(fldassigndate) as day,
if(SUBSTRING(DAYNAME(date),1,1)=’S’,’weekend’,’weekdays’) as week-off from your_tableName;
HERE : the day/week-off column is displayed based on the ‘fldassigndate’ column.if you give the fldassigndate(04-25-2012) means it will give you result like this.
Fldempployee——flddept——-Date——–Day——-Week-off
00625267-Karthick S Corporate 04-25-2012 Wednesday weekdays
otherwise please post your query
Cheers