Hey guys,
I need your help. I´ve got a problem, that really freak me out.
I have two DataObjects: "Page" and "Book". One "Book" has many "Pages".
The "Book" have a variable called "Active".
Now I want to get the IDs from "Page", but only from the pages which has an "active" Book.
So I need something like this:
SELECT Page.ID FROM Page
LEFT JOIN Book ON Page.BookID = Book.ID
WHERE Book.Active = 1
Now have tried to
$sqlQuery = new SQLQuery();
$sqlQuery->setFrom("Page");
$sqlQuery->selectField("Page.ID", "ID");
$sqlQuery->addLeftJoin('Book','"Page.BookID" = "Book.ID"');
$sqlQuery->addWhere(' "Book.Active"=1 ');
But with this code, I get the error "Unknown column Book.Active". Any idea, how to fix this?