Click here to Skip to main content
15,892,768 members
Home / Discussions / Database
   

Database

 
AnswerRe: How to Sort this Data Pin
dan!sh 16-Feb-10 6:13
professional dan!sh 16-Feb-10 6:13 
AnswerRe: How to Sort this Data Pin
Jörgen Andersson16-Feb-10 9:06
professionalJörgen Andersson16-Feb-10 9:06 
GeneralRe: How to Sort this Data Pin
Vimalsoft(Pty) Ltd16-Feb-10 19:14
professionalVimalsoft(Pty) Ltd16-Feb-10 19:14 
QuestionHow Pin
JustWorking16-Feb-10 1:57
JustWorking16-Feb-10 1:57 
AnswerRe: How Pin
Jörgen Andersson16-Feb-10 2:21
professionalJörgen Andersson16-Feb-10 2:21 
GeneralRe: How Pin
JustWorking16-Feb-10 19:49
JustWorking16-Feb-10 19:49 
GeneralRe: How Pin
Jörgen Andersson16-Feb-10 21:18
professionalJörgen Andersson16-Feb-10 21:18 
QuestionNot sure if this should be in Linq or Database so forgive me. How would I do a left join in linq to sql in c# Pin
tonyonlinux15-Feb-10 9:12
tonyonlinux15-Feb-10 9:12 
Here's My issue:
I have 4 Tables
Author                   BookAuthor
---------               --------------
ID                       BookID
AuthorFirst              AuthorID
AuthorLast

Book                     BookNumber
---------               --------------
ID                        ID
Title                     BookID
Price                     SurrogateNumber
Retired
Keywords


author.id linked to bookauthor.authorid
book.id linked to bookauthor.bookid
book.id linked to booknumber.bookid


I don't understand how to get all my records that have instances in BookNumber. Basically what is happening is I have 94 rows so far in booknumber (which is what i want), but since booknumber contains duplicate bookid's i only get a totaly of 86 rows back when i do the following:

var options = new DataLoadOptions();
                options.LoadWith<Book>(c => c.BookAuthors);
                options.LoadWith<BookAuthor>(c => c.Author);
                options.LoadWith<Book>(c => c.BookNumbers);



                db.LoadOptions = options;
                
                books = db.books.tolist();
                bookbindingsource.datasource = books;

and whenever I look in the database 86 books are in books (so that is right) because i have duplicates that were added to booknumber to make it the total of 94.

So my question is how do i get all 94 books instead of just the 86?
I tried this but its obviously wrong because I got like 116 results Frown | :(

var RightJoin = from b in db.Books
                                join ba in db.BookAuthors on b.ID equals ba.BookID
                                join a in db.Authors on ba.AuthorID equals a.ID
                                join bn in db.BookNumbers on b.ID equals bn.BookID into bookandBook
                                from bn in bookandBook.DefaultIfEmpty()
                                select b;
                bookBindingSource.DataSource = RightJoin.ToList();


I just want to be able to show every single book I have entered in the database where it has a unique surrogate number. In the current case only 94 books...

thanks for your help. Confused | :confused:
AnswerRe: Not sure if this should be in Linq or Database so forgive me. How would I do a left join in linq to sql in c# Pin
Pranay Rana15-Feb-10 19:22
professionalPranay Rana15-Feb-10 19:22 
Questionsql server express installation Pin
Yulianto.14-Feb-10 22:38
Yulianto.14-Feb-10 22:38 
AnswerRe: sql server express installation Pin
Not Active15-Feb-10 1:38
mentorNot Active15-Feb-10 1:38 
GeneralRe: sql server express installation Pin
εїзεїзεїз16-Feb-10 1:41
εїзεїзεїз16-Feb-10 1:41 
GeneralRe: sql server express installation Pin
Not Active16-Feb-10 6:32
mentorNot Active16-Feb-10 6:32 
GeneralRe: sql server express installation Pin
εїзεїзεїз16-Feb-10 6:58
εїзεїзεїз16-Feb-10 6:58 
GeneralRe: sql server express installation Pin
Not Active16-Feb-10 7:10
mentorNot Active16-Feb-10 7:10 
AnswerRe: sql server express installation Pin
εїзεїзεїз16-Feb-10 1:40
εїзεїзεїз16-Feb-10 1:40 
Questionexercize database schema: need advice Pin
mbrownphysics14-Feb-10 14:04
mbrownphysics14-Feb-10 14:04 
QuestionOrderBy Dilema Pin
danyDude14-Feb-10 11:53
danyDude14-Feb-10 11:53 
AnswerRe: OrderBy Dilema Pin
loyal ginger14-Feb-10 14:43
loyal ginger14-Feb-10 14:43 
GeneralRe: OrderBy Dilema Pin
danyDude14-Feb-10 15:46
danyDude14-Feb-10 15:46 
GeneralRe: OrderBy Dilema Pin
loyal ginger16-Feb-10 3:50
loyal ginger16-Feb-10 3:50 
GeneralRe: OrderBy Dilema Pin
danyDude17-Feb-10 20:56
danyDude17-Feb-10 20:56 
AnswerRe: OrderBy Dilema Pin
i.j.russell14-Feb-10 22:11
i.j.russell14-Feb-10 22:11 
QuestionMusic Database?? Pin
AmbiguousName12-Feb-10 23:35
AmbiguousName12-Feb-10 23:35 
AnswerRe: Music Database?? Pin
Andy_L_J13-Feb-10 0:10
Andy_L_J13-Feb-10 0:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.