Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » LEFT JOIN Problem

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1789 Views
  • thejackel
    Avatar
    Community Member
    33 Posts

    LEFT JOIN Problem Link to this post

    Hello,

    I'm trying to implement a custom search and am linking two tables together using LEFT JOIN. Below is the query I am running:

    $links = DataObject::get("SiteTree", "ShowInMenus = 1 AND ParentID = 23", "", "LEFT JOIN ConsultationPaperHolder ON ConsultationPaperHolder.ID = SiteTree.ID", "0, 10");

    It's supposed to join my ConsultationPaperHolder to the SiteTree table using ID. The problem is it keeps bringing back an Error page. It works withou the JOIN but just can't get it working with it.

    anybody have any ideas whats wrong with this?

    Thanks

  • thejackel
    Avatar
    Community Member
    33 Posts

    Re: LEFT JOIN Problem Link to this post

    Resolved it. SiteTree.ID needed to be `SiteTree`.ID

    Hopefully this may help someone in future

    1789 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.