Skip to content
Advertisement

Tag: sql

Count users with a condition in MYSQL

I have a table ‘helpdesk’ (detail below) that lists tickets. I’m trying to get the top 10 users who report issues, however there is a complication in the fact that users can report an issue for another user (think secretary for their boss as an example). The table structure is… Using the example above the count should return User 1

Pivot by Country Name and Flag in Postgresql

and I am trying to cross tab it like this: Here is my SQL query, I am not able to do it since I do not have permissions to create extensions (tablefunc) Is there an alternate way? Can you please help? Thank you. Answer As you ave only 2 values, you can make the classical approach to pivot country |

How to split an array in Clickhouse based on custom condition

I am trying to find a way to split my array when the next element is smaller than the previous element. Here is some sample data [100, 200, 500, 100, 150, 200] I need to convert this to [[100, 200, 500],[100, 150, 200]] I am trying to calculate the running difference of the array and I need to handle the

Advertisement