I am setting the type for sql query result set as List in java. I am trying to convert it into a dto. When I see the List structure from query. It shows resultList-ArrayList<E&…
Is there a way to calculate the average queue time of an entire column that contains data in time format
I have imported a data extracted from a cisco call center in SQLITE table. These data deals with information related to the incoming calls . Among this table , there is a column called “queue time” which indicates the time spent by the caller waiting in the queue before reaching an agent . I would…
fetch key value pairs from array objects in sql BigQuery
I need to parse the column mapping and fetch the key value pairs from the second object in array. I would like to create new columns with the fetched data. The data looks like this: The desired output: Answer Below is one of the approaches (BigQuery Standard SQL) if to apply above to sample data from your que…
Assigning result of For Xml and With clause to a variable
I’m trying to use XML for to concatenate a bunch of columns together and then assign the result set to a variable. I’m using ‘with’ clauses because my initial sub-queries contain calculated fields that later sub-queries need to generate additional fields. When I run it gives Lookup Err…
Get products with specific attribute term and specific category term in Woocommerce using SQL
I wish to find products with two different criteria. The code I used first to search one criteria is; This returns all those products (Object_ID) with the attribute “pa_1_scale” and ts.term_id = 400. I can also do this to return all products with product_cat and ts.term_id = 397, using a different…
Find ALL the prerequisites for a given course
I have the following tables: COURSE_PREREQUISITES My question is: How can I obtain all the course ids a student needs to take before he can take course id 6? Intended Answer: I should obtain the course id of 1, 2, 3, 4, 5. Attempts Made: I have tried selecting the prerequisite_course_id of the intended final …
Get total Sum from SQL Query of two tables
I have two tables which are as follows: Table1 and Table2. Table1 : Table2: I want a SQL query which would show me the result in total manner. The Output that I want is : I have done it using the PowerBI and I know it can be done using SQL too but I am not able to achieve it.
Select row in group with largest value in particular column postgres
I have a database table which looks like this. I need to group this table by id and select particular row where time_point has a largest value. Result table should look like this: Thanks for help, qwew Answer In Postgres, I would recommend distinct on to solve this top 1 per group problem: However, this does …
Sql pattern in like condition
Simple issue : I have fields (path) like : I want to be able to get the path containing 43/XX Meanings here the only valid one would be This seems not to be working Answer Only SQL Server supports using (a small subset of) regular expressions with LIKE. In MySQL, you would use RLIKE, or REGEXP (both are synon…
Shifting the total group by 1 step- MYSQL [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago. Improve this question Here I have name and pay as columns of a database table. Table has Name an…