Open parthshah2211 opened 4 months ago
this is my working query
AND GROUP BY
looks wrong. It should fail like this:
mysql> drop table if exists t; create table t(f text, a int); insert into t values(1, 'a', 1); select * from t where a = 1 and group by a;
--------------
drop table if exists t
--------------
Query OK, 0 rows affected (0.00 sec)
--------------
create table t(f text, a int)
--------------
Query OK, 0 rows affected (0.00 sec)
--------------
insert into t values(1, 'a', 1)
--------------
Query OK, 1 row affected (0.01 sec)
--------------
select * from t where a = 1 and group by a
--------------
ERROR 1064 (42000): P01: syntax error, unexpected BY near 'by a'
Can you please simplify your use case by removing from it everything which doesn't relate? Best if you can do it like the above example: create table
first, then insert one or multiple docs, then run your query to demonstrate the issue.
this is my working query
AND GROUP BY
looks wrong. It should fail like this:mysql> drop table if exists t; create table t(f text, a int); insert into t values(1, 'a', 1); select * from t where a = 1 and group by a; -------------- drop table if exists t -------------- Query OK, 0 rows affected (0.00 sec) -------------- create table t(f text, a int) -------------- Query OK, 0 rows affected (0.00 sec) -------------- insert into t values(1, 'a', 1) -------------- Query OK, 1 row affected (0.01 sec) -------------- select * from t where a = 1 and group by a -------------- ERROR 1064 (42000): P01: syntax error, unexpected BY near 'by a'
Can you please simplify your use case by removing from it everything which doesn't relate? Best if you can do it like the above example:
create table
first, then insert one or multiple docs, then run your query to demonstrate the issue. I did not understand what are you trying to say ?
I did not understand what are you trying to say ?
you need create minimal reproducible example with minimal documents count and query without unnecessary parts that could reproduce you case on the empty manticoresearch
Confirmation Checklist:
Your question:
this is my working query but it affects the entire data due to GROUP BY I can’t get data for the same value of,m_id,b_id, and status. I want to apply a sub-query for the sum of total_dp_price
I can do this manner but getting an error
SELECT l.id, l.marketplace_id, l.brand_id, l.status, l.data_points.price AS data_point_price, dp.total_data_point_price FROM listings l, JOIN ( SELECT brand_id, SUM( IF( SUBSTRING_INDEX(data_points.price, ‘$’, -1) REGEXP ‘^[0-9.]+$’, CAST(SUBSTRING_INDEX(data_points.price, ‘$’, -1) AS DECIMAL(10, 2)), 0 ) ) AS total_data_point_price FROM listings WHERE status = ‘NEEDS_REVIEW’ AND licensor_id = 692381349893783561 GROUP BY brand_id ) dp ON l.brand_id = dp.brand_id WHERE l.status = ‘NEEDS_REVIEW’ AND l.licensor_id = 692381349893783561 ORDER BY dp.total_data_point_price DESC, l.updated_at DESC LIMIT 10;
Config File: With indexing & other config
Listing Model:
this kind of error ERROR 2013 (HY000): Lost connection to MySQL server during query ERROR 1064 (42000): P01: syntax error, unexpected identifier, expecting $end near 'l,
Any Help Would Be Appreciated:
Your assistance in resolving this issue or providing guidance on how to achieve sub-query with this query