-
Notifications
You must be signed in to change notification settings - Fork 690
Open
Description
I've been trying to build this test app where user uploads csv file and then run SQL queries.
This is the SQL query.
SELECT [subcategoryname], SUM([totalamount]) AS sales
FROM temptable
GROUP BY [subcategoryname]
ORDER BY sales DESC
LIMIT 3
UNION ALL
SELECT [subcategoryname], SUM([totalamount]) AS sales
FROM temptable
GROUP BY [subcategoryname]
ORDER BY sales ASC
LIMIT 3;
As you can see here, what I tried to do was to get top/bottom 3 of SUM([[totalamount]) from the table, using UNION ALL.
However, what I've got returned follows: only three rows, where 2 containing 'null' sales value.
My assumption here was that ORDER BY somehow includes null values when sorting.
AlaSQL is based on unpaid voluntary work. Thank you for taking the time to make it better.
Got ChatGPT?
- Try the AlaSQL Bot for answering questions and helping you out with your programming. It has all the documentation and heaps of examples.
- https://chat.openai.com/g/g-XcBL24WTe-alasql-bot
Question about how to...
Something is not working as expected:
- Describe the problem.
- Provide code that replicates the problem.
- We suggest spawning a jsfiddle from https://jsfiddle.net/63xjwo4s/
Copilot
