Skip to content

Tag: sql

Count distinct with HUE/IMPALA

I have a table in HUE like : I need to count the distinct number of ProductID’s for each ID. Something like this : I’ve tried : What I really need to do is a count(distinct) inside the analytical function. HUE doesn’t let me do this. Is there another way I can count distinct for window of ro…

JSON_Query with For Json Path

Please see the table given below. The table contains the json string and need to create a json array with those json string. But When I use JSON_Query and For Json Path it adds additional header. (Alias name or the source column name). How to generate the json array without alias name or source column name. P…

Select Distinct Top One Record by Date

I am writing a script to compare software between servers but have a many-to-many relational situation to execute this cleanly. I’m thinking a distinct-top by latest date type of query may help. So that I can go from this To this shortened and clean list I am not exactly sure how to approach this? Shoul…

MySQL require a minimum length

I’m using MySQL Workbench and I made a table called ‘organizations’ and want to block any try of adding a value to a column with less than 5 letters. The column name is ‘namee’. I made this, but I get an error: Error: Answer Based on the error message you shared, you apparently t…