Quantcast
Channel:
Viewing all articles
Browse latest Browse all 4235

Many-to-many Unknown column

$
0
0

Hi - can anyone identify why this SQL statement will not work? Its really irritating because I just get an unknown column error on the CourseCategoryID. Which is complete rubbish because it DOES exist!!! (???)

$getCourses = Course::get()->innerJoin("course_coursecategories", "\"Rel\".\"CourseID\" = \"Course\".\"ID\"", "Rel")
    ->where("\"course_coursecategories\".CourseCategoryID = $courseCategoryId")
    ->where("\"Course\".\"SubjectAreaID\" = $subjectId");

I have used two WHERE clauses because I am assuming the WHERE's in SS double up as AND as well.

The only subtle difference I can ascertain is that when SS creates look-up tables it does not create class names for them thus you have to refer to the table directly. To be honest if anyone can just show me how to do a straight SQL statement in SS I'd be happy with that. I know its not the done thing but I just need to get this sorted!

Many thanks!


Posted to: Many-to-many Unknown column | Show Thread | Post Reply


Viewing all articles
Browse latest Browse all 4235

Trending Articles