Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mysql Error - SQLSTATE[42000] #1

Open
pctin opened this issue Mar 8, 2016 · 1 comment
Open

Mysql Error - SQLSTATE[42000] #1

pctin opened this issue Mar 8, 2016 · 1 comment

Comments

@pctin
Copy link

pctin commented Mar 8, 2016

I integrated this extension to my project as following code:
`public function init()
{
$parentRet = parent::init();

    $this->refinerSet = new \pahanini\refiner\Set([
        'refiners' => [
            // standard range
            'price' => [
                'class' => '\pahanini\refiner\db\Range',
            ],
            'teacher_id' => [
                'class' => '\pahanini\refiner\db\Count',
            ]
        ]
    ]);

    return $parentRet;
}`

in other action:
`$query = FECourse::find()->where(['status' => FECourse::STATUS_ACTIVE]);

    $refinerResult = $this->refinerSet->applyTo($query);

    $refiners = $this->refinerSet->getRefinerValues();
    var_dump($refiners);die;`

but get error:
_SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'all FROM courses WHERE (status=1) AND (teacher_id IS NOT NULL) GROUP BY teac' at line 1
The SQL being executed was: SELECT teacher_id as id, COUNT(*) as all FROM courses WHERE (status=1) AND (teacher_id IS NOT NULL) GROUP BY teacher_id

The problem is from Mysql with: 'as all', you need to change it to 'as all'

Can you update the lib for this?

@pahanini
Copy link
Owner

It's not quite clear what do you want to change, can you create PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants