I have 2 tables A and B, B is having a foreign key relationship with A i.e.,(b.detail_id = a.id) I want to apply LISTAGG query on one of the column in B. The above query is returning me a row with all values as null, But I want no rows. How can I achieve this? If it’s not possible any
SQL query get only parent directory
SELECT * FROM directory WHERE status_id = 10 AND workspace_id = 1 Above is my query and database table. dir_name = directory name dir_path = directory path For example, BbB is a nested directory …
AVG over time Window in Impala … OVER (PARTITION BY … ORDER BY)
I have a Table in Impala in which I have time information as UnixTime with a frequency of 1mSec. I am trying to get the AVG(), MIN() and MAX() for a window of 10Sec (But I do not want to fix it and can be 20sec, 30sec, etc). I am doing it using sub-queries but I am not getting the
SQL for adding another column showing Nth occurrence of unique ID within data-set
I have a table of patient visits, where each row is a visit. There is a column with the unique patient ID to signify which client the visit was for. I would like to add another column which shows the Nth occurrence of that patient ID within the data-set. So first visit would show 1, second visit shows 2 and
MySQL query get total of payments for everyday of the month until current date
I’m trying to build a MySQL query to get the total amount for every day of the month until the current date. I’m not sure if it’s possible with just one query. It would be something like: Today’s date = ‘2021-02-24’ In the end, I would have the total amount for every day. D…
replace all column values equal to one string with another string
I have a MYSQL table called traceclasses and I have a column in this table called value with some of its cell values equal to E as shown below. I would like to replace all such values with U. Which query should I use to do this? Answer You are looking for update:
Oracle how to select and update one field value and insert records quickly
We have the below scenario: create table create table tt (id number, name varchar2(30), note varchar2(4)); insert into tt values (1,’AC’,’m’); insert into tt values (2,’Test’,’f’); we want to select …
Convert array of timestamps in PostgreSQL (not in a table)
I need to get this command: to work for an array (or in rows). Reason is that I have a lot of timestamps that need to be converted and if I use the above structure, I just end up adding lots of columns that my front-end can’t handle. My current solution is to actually dump all of the timestamps into
Returning values from 2 select statements in Oracle Procedure
Homework question that I’m stuck on. I need to create a Procedure called dept_info with a department id as the IN parameter with department name and full name (concat of first and last name) of the manager of that department as the OUT parameters to be passed back to the invoking program. the procedure …
SQL Query with Excel VBA
I’m trying to run a SQL query with Excel VBA. I got the query from someone else. When I run this query, I’m getting the following error message: “The SELECT statement includes a reserve word or an argument name that is misspelled or missing, or the punctuation is incorrect.” I can̵…