5
Reply

linq query problem

Nickolas Novel

Nickolas Novel

Jul 19 2015 2:43 PM
391
 BOOK_ID (PK & FK)
PRICE_ON_START
 PRICE_PLUS_COST
PRICE_PLUS_EXTRA
 PRICE_TOTAL
 
 
 BOOK_ID (PK)
 USER_ID (FK)
GROUP
 PHONE
 LOCAL_ID
 
 USER_ID (PK)
 NAME   
 SURNAME
 SEX      
 ISACTIVE
 
 
Hello there,
 
I have got problem, because I don't know how to get required records.
So,  as you can see guys I have three tables, and my question is how to get for particular USER_ID all records from Table1 where GROUP number in second table is for ex == 4.
It means, that for each of the 12 groups I have different values in table1
 
BOOK_ID in the first and second table is the same number of course.
 
I'm trying something like that, but this not working :(
 
var collection1 = from a in table1 from b in table2 where a.book_id == b.book_id && a.user_id == 1 select b
and now I would like to do something like that 
 
var result =  from b in table2 from c in collection1 where b.book_id == c.book_id && b.group == 6 select b?
 
 
Please help... 

Answers (5)