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…
Tag: sql
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…
Major bug in MySQL 8.x? — foreign keys
While retrieving foreign keys information from MySQL (for a code generator) I noticed this strange behavior. It looks like a major bug in MySQL 8.x. When I create a foreign key using REFERENCES the …
count(*) doesn’t return 0
i have a sql problem ,please help me this is my query select count(category_value .list_value_id) as jobs , category_type.value as category from list_values category_type full outer join params …
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…
SQL statement to select all dead people
I have tables: City: zip, name,… People: id, city_zip(refers to city.zip), born_time, dead_time I need to select data about cities where ALL people from that city are dead: born_time NOT NULL AND …
Join two table with Multiple cases in ON condition
I have two tables A and B and I have to perform left join on that with multiple cases in on condition. Is there any efficient way of doing this in big query or SQL. Here my main motive is that for one row if my case1 matches than it will not go into other cases. Likewise it will work
How to loop through table using while loop and create another table with values needed
I have two tables: MainTable and MyTable. MyTable has unique ControlNo and ID. I need to add very first EffDate from MainTable to MyTablebased on ID and ControlNo. For that I need to look at …
Replace blank value with a default value in SQL
i have the below query which return blank values for the column property_value : select target_name,target_type,property_name,property_value from oracle_properties where target_name like ‘DY01EPI%’ …