Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

sql - Detect overlapping date ranges from the same table -


i have table following data

pkey  start       end         type ====  =====       ===         ==== 01    01/01/2010  14/01/2010  s 02    15/01/2010  31/01/2010  s 03    05/01/2010  06/01/2010  

and want following results

pkey  start       end         type ====  =====       ===         ==== 01    01/01/2010  14/01/2010  s 03    05/01/2010  06/01/2010  

any ideas on start? lot of reading i've done suggests need create entries , each day , join on matching days, way?

if have entries each day should work, if don't overhead significant, , if query used often, if affect performance.

if data in format, can detect overlaps using simple date arithmetic, because overlap 1 interval starting after given interval, before given finished, like

select dr1.* date_ranges dr1 inner join date_ranges dr2 on dr2.start > dr1.start -- start after dr1 started   , dr2.start < dr1.end -- start before dr1 finished 

if need special handling interval wholly within interval, or need merge intervals, i.e.

pkey  start       end         type ====  =====       ===         ==== 01    01/01/2010  20/01/2010  s 02    15/01/2010  31/01/2010  s 

yielding

start       end         type =====       ===         ==== 01/01/2010  31/01/2010  s 

you need more complex calculation.

in experience kind of problems, once how calculation hand, it's easy transfer sql :)


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -