Skip to content

Tag: sql

Microsoft Access 2016 SQL Unnest Array

I am trying to take a table and in Microsoft 2016 Access and use SQL to unnest a single column into multiple rows instead. It is comma separated. I tried adding Unnest and keep getting errors, maybe I am missing something. This BOGO_Sale.promo_parent_skus is the only column I am trying to unnest into rows. An…

Calculate TimeDiff in Pandas based on a column values

Having a dataframe like that: Desirable result is to get aggregated IDs with time diffs between Start and End looking like that: Tried simple groupings and diffs but it does not work: How this task can be done in pandas? Thanks! Answer A possible solution is to join the table on itself like this: Output:

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 =

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 …

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 …