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
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.
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?
Question about how to...
Something is not working as expected:
The text was updated successfully, but these errors were encountered: