Wednesday, 15 September 2010

Display records for a week in gridview asp.net with MYSQL -



Display records for a week in gridview asp.net with MYSQL -

in database have column named "taskdate","taskname","tid" of table "tbltask", if open gridview must display week assigned tasknames i.e) if taskdate contains records between 6th oct , 11th must display records in gridview if open gridview next week must display next week records alone

i tried query in ms sql dono how same in mysql

ms sql query #1

select * task tdate >= dateadd(day, 2-datepart(dw, getdate()), convert(datetime,getdate())) , tdate < dateadd(day, 9-datepart(dw, getdate()), convert(datetime,getdate()))

ms sql query #2

select * task '2014-10-08' between dateadd(wk, datediff(wk, 0, tdate), 0) , dateadd(wk, datediff(wk, 0, tdate) + 1, 0)

try this

previous week's data

select * task taskdate >= curdate() - interval dayofweek(curdate())+6 day , taskdate < curdate() - interval dayofweek(curdate())-1 day

current week's data

select * task yearweek(taskdate) = yearweek(current_date)

mysql asp.net

No comments:

Post a Comment