I have been trying to use Yii-Sphinx extension and its working fine when i used a simple query but when i try to use left join then it does not work. It returns the below error. I have tested many queries but not working. I am using Yii-Sphinx extension
SQLSTATE[42000]: Syntax error or access violation: 1064 sphinxql: syntax
error, unexpected IDENT, expecting $end near 'LEFT JOIN specs ON specs.id =
listing.specs_id'
The SQL being executed was: SELECT specs.id, listing.title,listing.specs_id,
listing.reg_no, listing.price, listing.status, listing.featured FROM listing
LEFT JOIN specs ON specs.id = listing.specs_id
Error Info: Array
(
[0] => 42000
[1] => 1064
[2] => sphinxql: syntax error, unexpected IDENT, expecting $end near
'LEFT JOIN specs ON specs.id = listing.specs_id'
)
here is my query
SELECT specs.id, listing.title,listing.specs_id, listing.reg_no, listing.price, listing.status, listing.featured FROM listing LEFT JOIN specs ON specs.id = listing.specs_id
I have solved this issue. Here is the detail for anybody who gets stuck in such an issue. Following is my solution with sphinx query builder available in yii2-sphinx extension:
'listing' is the index from the sphinx config file, Join query can be written in sql_query
What i was doing wrong that i was using the simple query rather than query builder and that solved the issue. For example, join query will not work with the below code.
Simple query will be executed but the query with any join will return error.