locked
Change SQL to Linq/ Lambda expression RRS feed

  • Question

  • User1944590867 posted

    Hi, I would like to join two tables in the MVC controller. How do i change the below SQL codes into a linq or lambda expression? I would like to get all the data column from User as Event and booking have a relationship but user and event does not have a relationship. Thank you very much for your help.

    SELECT e*
    FROM Event e, Booking b, User u
    WHERE e.id = b.event_id
    AND b.id = u.booking_id

    Saturday, January 21, 2017 10:30 AM

All replies

  • User1289604957 posted

    Hi,

    jmetjm99

    SELECT e*
    FROM Event e, Booking b, User u
    WHERE e.id = b.event_id
    AND b.id = u.booking_id

    from Event e, Booking b, User u
    where e.id == b.event_id and b.id == u.booking_id
    select e;

    Best,

    Maher

    Sunday, January 22, 2017 3:28 PM