0

Hello this is my linq query,

 var RoutineRemarks = (from i in _context.TableA.Include(a => a.pm_routine_report_type)
                              from j in _context.TableB.Include(a => a.PM_Evt_Cat).Include(b => b.department).Include(c => c.employees).Include(d => d.provncs)

                              orderby i.seen_by_executive_on descending
                              orderby j.English_seen_by_executive_on descending



                              // Here i face the problem, i want to select i+j
                              select i+j).ToList();

At the end it allows me to only select either i or j, but i want to select both, how can i do that?

John Kamaal
  • 129
  • 8
  • There"s (probably) more wrong with your query, it returns `i * j` combinations because there's no join between both. What exactly do you want to return? Also, it's important to know which flavor of LINQ you're using. Entity Framework core? – Gert Arnold Feb 16 '19 at 16:12
  • https://stackoverflow.com/questions/12475850/sql-query-return-data-from-multiple-tables – Jsperk Feb 16 '19 at 16:38

1 Answers1

0

Try in this way

select new {I=i, J=j}).ToList(); 

I also agree with @GertArnold. it is most likely that your main query needs join, but it is hard to tell what you need to do without knowing your ERD

Derviş Kayımbaşıoğlu
  • 28,492
  • 4
  • 50
  • 72