There is a table in which the managers column and the status column. How to calculate the total status of Fully, the divided total of records with all statuses except N / A for each manager? I tried to portray in this way, but nothing came of it First Query Second Query Need to recieve two columns with name a…
json_contains issue with the query, like
I try to find a food with some categories stored in the categories column as json. My query : select * fromfoodswhere json_contains(categories, ‘[“Aliments”]’) this should return at list one element …
how to use GROUP BY based on 2 specific columns
I have a table in SQL Server which looks like this : each ticket id can have multiple order issue. On each row I need to calculate ticket full revenue as below : SUM(revenue) of all items within the same ticket id So in my case, ticket id has 3 items (10,20,30) so the ticket full revenue = 30+5+15 =
mysql Cumulative sum for each unique ID in each sale:
I have trouble adding and accumulating my amounts per id, I use this solution but it doesn’t work and it adds up all the ids, I use this: any solution? ineed this For version 5.7 ? Answer You can use a SELECT statement containing window analytic function instead of an UPDATE statement : acumulado column…
SQL order with equal group size
I have a table with columns month, name and transaction_id. I would like to count the number of transactions per month and name. However, for each month I want to have the top N names with the highest …
What is the correct syntax?
I wrote a sql query to update data of ‘tbl_products’. Here is the query update tbl_products set product_count = (product_count – tbl_order_details.product_sales_quantity) from tbl_products join …
Store procedures for delete a repeat records
Hello i have a table in MySQL: “contracts” where i create a 3 record’s for each client_id, but one bug in the backend create more records on some client_id i try create a store procedure to …
calculate the percentage with sql and DOMO
I have a table where I want to calculate the percentage of revenue using the following formula: (Advertiser Revenue / Total Revenue) * 100. Data => Here is my code and what I have tried: Error: syntax error: execute command denied to user Answer In Domo, this calculation would best be done at the visualiza…
Return multiple values in varchar2
I want to return the values of several columns (With a function) in a varchar2 but I get an error when I choose several columns in select. FUNCTION FU_PRUEBAS (P_IDNUM MAC.IDNUM%TYPE) RETURN VARCHAR2 …
Case statements around values in a list
I have a table that looks like below after performing certain joins: create table test(id varchar(10), sub varchar(20)); insert into test values(1,’a’) insert into test values(1,’b’) insert into …