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 Dynamic Column Query -


possible duplicate:
is there way create sql server function "join" multiple rows subquery single delimited field?

i have table of "events", , each event has a list of 1-4 (essentially variable #) "users". let's events today, , want list users dynamic number of columns, rather repeated rows.

right have

select e.eventid, e.time, u.name events inner join users u on e.userid = u.userid date = '12/20/2010' 

this brings me results like:

eventid, time, name 211, '4:00am', 'joe' 211, '4:00am', 'phil' 211, "4:00am', 'billy' 218, '7:00am', 'sally' 218, '7:00am', 'susan' 

i can work , it's acceptable, duplication eventid , time (there more columns in actual query) seems wasteful me. in output this:

eventid, time, name1, name2, name3 211, '4:00am', 'joe', 'phil', 'billy' 218, '7:00am', 'sally', 'susan', null 

i have tried looking @ tutorials pivots (i have sql 2008), don't know if conceptually match i'm trying do. of them using "min" or "max".

maybe can't done? other alternative list of events today, , loop through that, finding recordset of users event. prefer grab in 1 query though.

any ideas?

returning variable number of columns harder deal in code. result set getting easy transform object can worth in code.

what trying output?


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 -