I’d like to find an efficient way to filter my RANK() OVER function in SQL. I have the following query: SELECT base.ITEM_SKU_NBR, RANK() OVER (ORDER BY SUM(base.NET_SLS_AMT) DESC) AS …
Migrate data from SQL Server to PostgreSQL
I have a stored procedure function as well as table in the SQL Server enterprise 2014. I also have data in the table. Now I need same table and data in PostgreSql(pgAdmin4). Can anyone suggest to me the idea to migrate data to POSTGRESQL or any idea on creating the SQL script so that I can use psql to run
Variable not defined on VBA about socket
I’m making an edit to a project on VBA that uses a Socket to send information to a program on Netbeans on a specific server. I did not write the code. I’m trying to understand what the original programmer did. I have many forms, and a few send information with that socket. I’m trying to do t…
Oracle – Concatenate calculated number field with string field
In this case statement below, I want the result to be a string, either ‘n days’ or ‘n weeks’ based on the conditions in the statement. How can I concatenate the number generated from ABS(FLOOR(TRUNC(i.schedule_finish) – TRUNC(sysdate))) with a string (that is, ‘ days’…
How to make this Query without using UNION?
I am not very good at making query’s. So could someone explain and help me with this query? I need to inner join 2 tables ‘Slaap’ And ‘Eten’. i need all ‘eten’ where ID = 5 and i need all ‘Slaap’ where ID = 5. I could only achieve this with a UNION but tha…
Count nested records in SQL query
I have a problem that I need to select all owners who have 2 different companies where each company is on 2 different projects. For example : I tried to do like this : But it did not work. How to use a SQL query to solve this problem? For this case above, the query is expected to return: Answer
Cosmos db sql query for search in array
I have a document structure like below and I try to implement searching for user by fields author and partNames, so user can do query like SELECT * FROM c WHERE CONTAINS(c.author, ‘John’) and user will get in result the id=1 document because the name of author was John. The next step is to allow u…
SQL: join on foreign key between two tables and return only count of items; not actual items
I know there’s lots of questions similar to this out there. I’m writing my first SQL query; and I’ve been looking through SO but I can’t find out specifically what I’m doing wrong, because to me, they …
sql server – checking existence for each row in insert
I need to do an insert and check for each row if the field “partita_iva” is already in this table, if yes the field “flag” must be 1, if not then must be 0. I did this, but it set 1 for all the rows, …
How to use SUM and MAX on the same column?
So I’m having an SQL table where I will need find out the product that has been purchased the most meaning that I need to do a SUM and a group by on all the quantity of the products: SELECT …