I’m creating a new table using PostgreSQL, but I need to get a parameter from another table as an input. This is the table I have (I called table_1): id column_1 1 100 2 100 3 100 4 …
SQL Daily Outstanding Sales, Rolling Aggregate?
With the below test data I am trying to show how many sales have not been actioned by a colleague, an outstanding sale is any record that is still showing as “New”, I have been using the below to …
How to use Update command with CASE statement in Oracle?
I have to update the Matching Flag Column depending on the following Condition : When F_ZN=IC_ZN AND F_STN=IC_STN then Matching Flag would be set to 1 else 0 ,I could think of this but I don’t know …
Convert Data Rows into string array c#
I want to convert my data table rows data into string array, plse guide my….. i tried this but its showing nullException
SQL Query to get the count of Json Array
I have the below Json object. How do I get the count of Object Array. { “Model”: [ { “ModelName”: “Test Model”, “Object”: [ { “ID”: 1, “Name”: “ABC” }…
How to parse quotes correctly?
I’m using ANTLR with Presto grammar in order to parse SQL queries. This is the definition of the string I’m using: However, when I have a query like this: it mess things up as it parses : ”’,’ as one string. When I used the following rule instead: I didn’t parse correctly q…
Selection based on multiple conditions
I have a requirement to select Customers based on the Channel and Organisation i.e., the order of selection of Customers should be based on Channel – 10,40,20,30 and all the organisations for that …
Count entries by ranges?
I have a table like so: I need query which returns this: Count of users with this sum of amounts(balance) Answer You have to aggregate twice. The first time to SUM amount for each user. The second time to count the number of users for each amount.
How to calculate percentage in group by with condition?
I have a table with this schema: I need to know percentage of failure for example: google -> 50% failure Facebook -> 100% failure I use mysql 5.7 I tried to reach this destination using group by, but I couldn’t Answer You can do conditional aggregation. I like to do this with avg(): For each provi…
SQL – Select the most close values to date in a table
Hi everyone i have a table called measure made up like this And I want to select all the lowest values such as I can do it by code but i prefer to use SQL for performance reason so I tried this query: but the result is not good, I see too many results and are also somehow duplcated, how