Below is the schema for tblagegroup
CREATE TABLE `tblagegroup` (
`AgeGroupID` tinyint(3) UNSIGNED NOT NULL,
`MinAge` int(11) NOT NULL,
`MaxAge` int(11) NOT NULL
);
Below is the schema for tblcontentlibrary
CREATE TABLE `tblcontentlibrary` (
`ContentLibraryID` int(11) NOT NULL,
`AgeGroupID` tinyint(3) UNSIGNED NOT NULL
);
AgeGroupID is associated in both tables.
I am trying to get those records from tblcontentlibrary where MinAge >= 2 and MaxAge is <= 4
Below is what i tried.
\App\Models\ContentLibraryModel
::with('AgeGroup')
->where('MinAge', '>=', $years)
->where('MaxAge', '<=', $years)
->get();
I am getting below error.
Column not found: 1054 Unknown column 'MinAge' in 'where clause' (SQL: select * from
tblcontentlibrary
whereMinAge
>= 0 andMaxAge
<= 0)
Am I missing anything?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire