1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00
Files
mariadb-columnstore-engine/mysql-test/columnstore/basic/r/MCOL-5772-hidden-order-by.result
Sergey Zefirov 7ec8f3df9a MCOL-5772: incorrect ORDER BY ordering for a columns not in GROUP BY (#3214)
When ORDER BY column is not in GROUP BY, is not an aggregate and there
is a SELECT column that is also not an aggregate, there was a problem:
ordering happened on the SELECTed column, not ORDERed one.

This patch fixes that particular problem and also performs some tidying
around newly added aggregate.
2024-06-25 16:10:27 +04:00

24 lines
697 B
Plaintext

DROP DATABASE IF EXISTS MCOL5772;
CREATE DATABASE MCOL5772;
USE MCOL5772;
CREATE TABLE products (
product_id INT,
product_name VARCHAR(100),
category VARCHAR(50),
unit_price DECIMAL(10, 2),
stock_quantity INT
) ENGINE=Columnstore;
INSERT INTO products VALUES
(1, 'Laptop', 'Electronics', 1200.00, 50),
(2, 'Smartphone', 'Electronics', 800.00, 100),
(3, 'Coffee Maker', 'Appliances', 50.00, 30),
(4, 'Backpack', 'Fashion', 40.00, 80),
(5, 'Desk Chair', 'Furniture', 150.00, 20);
SELECT product_name, SUM(stock_quantity) AS total_stock FROM products GROUP BY category ORDER BY stock_quantity;
product_name total_stock
Desk Chair 20
Coffee Maker 30
Backpack 80
Smartphone 150
DROP DATABASE MCOL5772;