my table this is the result I want to display john — total paid shoes and bag dave <– total of bag,’shoes is unpaid so 1000 is not added to total’ this is my controller it gives me an error the total is same in all name Answer You could look to join sub queries, that certainly would…
Is it Possible to Merge Rows in SQL from Just One Column?
I wonder if it is possible to merge multiple rows from just one column in SQL. Here’s an example of my initial table: Here’s my expected output: I do not know if it’s possible to have a table like the later one. So, any advice would be much appreciated. Answer This type of task is usually do…
Group rows by the same value in the field, while matching on partial value only
I have a table that has many rows (between a few 1000s to a few million). I need my query to do the following: group results by the same part of the value in the field; order by the biggest group first. The table has mostly values that have only some part are similar (and i.e. suffix would be different).
Query to select records belonging only to ID and SUB-ID
I’m trying to construct a query to return only the records related to a given ID and SUB-ID. In case the condition is not met I would like to return the second possibility, i.e, the second combination ID, Sub-ID. Note: The data has thousands of IDs, but only 2 Sub-Ids per ID. This is an example of input…
SQL Combining MAX and SUM
So I have one SQL table that contains the below columns: There are ~2800 unique License numbers and will have numerous FundsIn each day. I am trying to find the last date there was activity (ActivityDate) and the sum of all of the FundsIn on that MAX ActivityDate. Below is a query I’ve been trying to mo…
Trying to make a new table by pulling data from two tables and keep getting ‘Error: Every derived table must have its own alias’ on this query
I have an ‘Orders’ table and a ‘Records’ table. Orders table has the following columns: Records table has the following columns: I’m trying to pull and compile the following list of data but I keep getting an error message: Here’s my query: What am I doing wrong? Answer The…
Count BigQuery event.params based on event.key
I am attempting to count the events filtering on their parameter. For example, suppose that I have the following. Here’s the real one for the inquisitive minds out there. https://i.imgur.com/rPwmR9i.png event_params.key and event_params.value is an array of values. I need to filter out anything in that …
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…