I have to search for a particular hour and minute within a column of a table. For example: activitydate (timestamp without time zone) ——————— “2021-02-11 00:00:00” “2021-…
Tag: sql
SQL Query doesn’t work in Azure SQL Data Warehouse (Synapse) why not?
I have an SQL query that works in an on-premise SQL Database, but when I try to execute it on an Azure SQL Data Warehouse, I get an error. Does anyone know another way of writing this SQL Query so …
Sum values from 2 joined tables even if id’s don’t match
I’m trying to take two tables, join them together based on their contract numbers and then get a sum of each customers contract amount between two years. However, some of these contracts were from an …
Conditional Data Validation In SSIS
I have a situation where table has two main columns DataFieldName & DataFieldValue along with some identifier such as OrderNumber. Now in DataFieldName there is value named as “OrderDate”…
How to convert SQL query to Linq in Entity Framework 6?
How can I convert this SQL query to a linq expression? Select distinct Clients.Id From Clients Join Orders On Clients.Id = Orders.ClientsId and Orders.Date < DATEADD(DD, -Clients.Term, CAST(…
Efficient Multiple Group-bys
I have the following table: Year Week Day_1 Day_2 Day_3 2020 1 Walk Jump Swim 2020 3 Walk Swim Walk 2020 1 Jump Walk Swim I want to group by YEAR, WEEK and Event (Walk, jump, Swim) and count the …
PL/SQL Dynamic SQL : Table name not valid
I’m currently learning PL/SQL. I need to create a PL/SQL block to create a backup of all my tables like this : myTable -> myTable_old. Here’s what I got right now : DECLARE Cursor c IS SELECT …
SQL to get 3 adjacent actions without duplicate from the flags
I have a question that a little bit similar with question#66044663 but more complicated. Here’s my dummy data. I want to get 3 adjacent actions(no duplicate) from the flag by each user. Here’s the …
How do I create an automated calculated column?
Help me create a column, that shows the company’s budget. Let’s say we have three tables: Budget, Purchase, and Sale. When we selling products, the budget increases, when buying raw materials, it decreases. That is, automatically when you add a value to these tables, the budget value immediately c…
weekly max count record in oracle
table test has column id,created_date,sal and data like below: ID create_date sal 1 20-JAN-2021 5000 2 20-JAN-2021 6000 3 19 -JAN- 2021 4000 we have data like this for each date. I pick the each day record count using below query: I want output for max record count for a weekly basis: count(*) create_date 500…