You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SingleStore driver generates the query as follows:
SELECT
FROM (select count() as aggregate
from (SELECT
FROM (SELECT *
FROM (select orders.make, orders.part_no
from scanitparts.orders
where orders.dealer_id = 1407
and date(orders.order_date) > 2023 - 12 - 04)
union
(select shipments.make, shipments.part_no
from scanitparts.shipments
where shipments.dealer_id = 1407
and date(shipments.shipped_date) > 2023 - 12 - 04))
order by part_no asc) as temp_table)
order by part_no asc
When using the mysql driver the same code block generates the following query:
select count(*) as aggregate
from ((select `orders`.`make`, `orders`.`part_no`
from `scanitparts`.`orders`
where `orders`.`dealer_id` = 1407
and date(`orders`.`order_date`) > '2023-12-04')
union
(select `shipments`.`make`, `shipments`.`part_no`
from `scanitparts`.`shipments`
where `shipments`.`dealer_id` = 1407
and date(`shipments`.`shipped_date`) > '2023-12-04')
order by `part_no` asc) as `temp_table`
The SingleStore driver is adding an extra Select From ... order by on the count() result, which then creates the error Unknown column 'part_no' in 'order clause'. I assume the SingleStore driver should function the same way the mysql driver does in this example?
The text was updated successfully, but these errors were encountered:
I created a PR with a fix for this issue. The problem is that when having an aggregate query with unions or having the query can just be returned, no need to wrap it and add orders, limit or offset
I've run into an issue with the way the SingleStore driver handles the following code block.
SingleStore driver generates the query as follows:
When using the mysql driver the same code block generates the following query:
The SingleStore driver is adding an extra Select From ... order by on the count() result, which then creates the error
Unknown column 'part_no' in 'order clause'
. I assume the SingleStore driver should function the same way the mysql driver does in this example?The text was updated successfully, but these errors were encountered: