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 - Combine results from two tables into one recordset -


i have 2 tables items , content.

 items:|id|menu|img 

table

 itemcontent |id|parent|title|content 

content holds paired items parent holding title , content

i want search items , print out records wich not have title present in itemcontent table whereby titles printed "empty". printing out output like:

 title: test1 , id: items.id=1 title: empty , id: items.id=2 title: empty , id: items.id=3 title: test2 , id: items.id=4 title: empty , id: items.id=5 etc... 

i tried following , no avail:

select items.*, itemcontent.title, itemcontent.content items, itemcontent itemcontent.title '%$search%'      , itemcontent.parent = items.id  order title asc           

a little appreciated

since want rows items whether or not have match in itemcontent, plus field itemcontent when there match need use outer join:

select items.*, coalesce(itemcontent.title, 'empty'), itemcontent.content items left outer join itemcontent on itemcontent.parent = items.id   (itemcontent.title '%$search%' or itemcontent.title null)  order items.id, itemcontent.title asc     

there small differences among sql dialects (for instance, not versions have coalesce) if want more precise answer indicate product you're using.


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 -